View Full Version : fsockopen or fopen at the same time
kaikai
02-03-2004, 11:36 AM
<?php
$fp = fopen ("http://www.about.com", "r"); // take 1 second
$fp1 = fopen ("http://yahoo.com", "wb"); // take 2 seconds
$fp2 = fopen ("http://www.example.com/", "r"); // take 2 seconds
?>
total take 5 seconds if run one by one.
but how to run them at the same time and take only 2 seconds at all?
firepages
02-03-2004, 02:51 PM
You could open 3 seperate processes using say popen() or proc_open on *NIX , each would then be running as a seperate process which you could poll , but its not as straightforward as perhaps it could be.
kaikai
02-03-2004, 03:17 PM
how can I open 3 different process?
Can you give me an example?
Thanks
firepages
02-03-2004, 04:26 PM
ok well my first try did not work :( , thats on windows so I will try on RodneyRedhat in a bit (assuming I did compile with pcntl !).
My main experience with trying to thread on win32 is with php-gtk which gives us some extra functionality with
/*where script.php actually does the fsockopen*/
$pp=popen('/usr/bin/php -q -f script.php args' , 'r' ) ;
while( gtk::events_pending() );
gtk::main_iteration();
which allows us to open a pipe via popen & then do other stuff whilst that works away , so not sure how to implement this via the webserver ?? in fact I am beginning to think that it wont work unless running as a CGI anyway ? dunno , interested to know any other ideas
kaikai
02-04-2004, 02:42 AM
Thanks for firepages
but it doesn't work.
Can any one help me?
Thanks
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.