tiganulmeu Posted June 13, 2007 Share Posted June 13, 2007 Hy there, ok, i`ll get to the problem: My php script has a function named curl(some curl options and instructions), it doesn`t matter that, what it matters: $var1 = curl("http://www.somedomain.com/somepage1.php"); $var2 = curl("http://www.somedomain.com/somepage2.php"); $var3 = curl("http://www.somedomain.com/somepage3.php"); $var4 = curl("http://www.somedomain.com/somepage4.php"); Ok, so it downloades the content of somepage_.php to the $vars, however somepage_s_.php contains several scripts which takes a verry long time for the page to download, so my script waits for each page to download, one by one, as line by line, what i would like do rezolve is to start the curl without waiting to download the first page, then the second and so on, it should start the download of all the pages at almoust the same time. That would be all, please help, i`ve lost 4 nights trying to get this fixed but no luck Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted June 13, 2007 Share Posted June 13, 2007 either fork your script or call the pages in order of least processing time. Quote Link to comment Share on other sites More sharing options...
tiganulmeu Posted June 13, 2007 Author Share Posted June 13, 2007 i don`t understand what "fork" the scripts means, also the download pages takes 5-6 hours to download ... Any ideea ? Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted June 13, 2007 Share Posted June 13, 2007 then forking really is what you need http://www.phpfreaks.com/tutorials/71/0.php Quote Link to comment Share on other sites More sharing options...
tiganulmeu Posted June 14, 2007 Author Share Posted June 14, 2007 OK, was a good ideea but running a background process won`t be posible as i don`t have command line access, is there anything else i can do ? like a function or class. Or maybe if i can discconect the download right after i start the curl to somepage.php as i used ignore_user_abort on the somepage1.php and i don`t need really need the download to complete ...... New ideeas ? Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted June 14, 2007 Share Posted June 14, 2007 not really - you could separate them out and have a separate window for each (running this the browser is an awful idea though - suggest you get access to fork asap). Quote Link to comment Share on other sites More sharing options...
tiganulmeu Posted June 14, 2007 Author Share Posted June 14, 2007 I`m already using the explorer version, to launch them in separate windows but it`s more complicated .. and i need to "upgrade" ... maybe we can fix this with some curl option or timer, this is the function i`m using: function curl($url, $cookie='', $post='') { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_REFERER, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); if($post !== '') { curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); } if($cookie !== '') { curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie); } curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); $result = curl_exec ($ch); curl_close ($ch); if($result == "") { curl($url, $cookie, $post); } else { return $result; } } EOF What do you think, can i somehow disconnect after a period of time ?... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.