Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

phpmyadmin fehler rechte unerlaubte mischung, WWWXXXApc, lilo trying to map files from unnamed device 0x0000", Wwwxxxapc, CAM::PDF::Renderer::TextF Fragen, adodb.recordset error '800a0cc1', php save mails as eml, WWWXXXAPC, sqlexpress database file auto-creation error, sqlexpress database file auto-creation error

Links

XODOX
Impressum
Datenschutz

#1: Two connections at the same time

Posted on 2008-01-21 10:52:11 by Marcel Molenaar

I am busy with a PHP application which sells products.

Per product i need to check the stock at two different locations (on the
web) through
SOAP requests.

Now the first request takes 2 seconds and the other 3 seconds so 5 seconds.

It would be nice to fire the two requests at the same time so the total
would be 3 seconds instead of 5 seconds.

I do not think this is possible with PHP or am i wrong?

Thanks in advance!

Marcel

Report this message

#2: Re: Two connections at the same time

Posted on 2008-01-21 16:45:51 by Janwillem Borleffs

Marcel Molenaar wrote:
> It would be nice to fire the two requests at the same time so the
> total would be 3 seconds instead of 5 seconds.
>
> I do not think this is possible with PHP or am i wrong?
>

If you are using fsockopen to build your connection, you can use
stream_set_blocking to select non-blocking mode, which enables you to do
multiple requests as the following example shows:

http://playground.jwscripts.com/async-streams.phps

Using the SOAP extension, you might be able to use forking:

http://www.php.net/manual/nl/function.pcntl-fork.php

See this page for OS-specific restrictions.


HTH;
JW

Report this message

#3: Re: Two connections at the same time

Posted on 2008-01-22 13:26:39 by Marcel Molenaar

"Janwillem Borleffs" <jw@jwscripts.com> wrote in message
news:4794be2d$0$64162$dbd4f001@news.wanadoo.nl...
> Marcel Molenaar wrote:
>> It would be nice to fire the two requests at the same time so the
>> total would be 3 seconds instead of 5 seconds.
>>
>> I do not think this is possible with PHP or am i wrong?
>>
>
> If you are using fsockopen to build your connection, you can use
> stream_set_blocking to select non-blocking mode, which enables you to do
> multiple requests as the following example shows:
>
> http://playground.jwscripts.com/async-streams.phps
>
> Using the SOAP extension, you might be able to use forking:
>
> http://www.php.net/manual/nl/function.pcntl-fork.php
>
> See this page for OS-specific restrictions.
>
>
`
Interesting!

Thanks for your help!

Marcel;

Report this message