Server gets crashed when using curl in php
I have spent whole day in debugging in it, but can't get any solution... PLz anyone help me.
I am trying to fetch data from a site by using curl. My PHp version is 4.3.9
Here is the code i have used,
function ipaddress($ip)
{
$url = 'http://www.example.com?x=' . $ip;
$curl = curl_init ($url) or die ('curl_init() failed');
curl_setopt ($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($curl, CURLOPT_TIMEOUT, 5);
curl_setopt ($curl, CURLOPT_URL, $url);
$data = curl_exec ($curl);
curl_close ($curl);
}
I call this function for about 60 times in a loop with different ip address at a single page load. On doing this often the server get crashed and my site is not loading. It get loading only after i restarted the server.
I searched in some forums, they all said about the execution timeout and the connection timeout...
Anyone who had be familiar with this can help me or suggest me an alternative way to do this...
Thank you...
-
walkerj -
Thanks - 1 reply
{{ DiscussionBoard.errors[4025176].message }}-
ram07 -
Thanks
{{ DiscussionBoard.errors[4025209].message }} -
-
-
paulpalm -
Thanks
{{ DiscussionBoard.errors[4025663].message }} -
-
stma -
Thanks
{{ DiscussionBoard.errors[4027569].message }} -