set it too 300 which is approx 300 secs = 5 minutes
ini_set('MAX_EXECUTION_TIME', 300);
if you set it to 0 , which mean no limits.
ini_set('MAX_EXECUTION_TIME', 0);
for cURL you can use this one
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
here again 0 means infinite...