ansharma Posted January 16, 2012 Share Posted January 16, 2012 Hi all i am trying to use curl function recursively but when the function first execute it get the content but next time it give the following error Protocol http not supported or disabled in libcurl $url = "http://www.example.com"; pager($url); function pager($url){ $urlArray = array(); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); echo curl_error($ch); // code to get url from result // i get an array here $urlArray curl_close($ch); foreach($urlArray as $value){ $urlval = urlget($value); if($urlval) { $urlval = str_replace("href=","",$urlval); $urlval = str_replace("'","",$urlval); echo $urlval.'<br>'; pager($urlval); } } } Quote Link to comment https://forums.phpfreaks.com/topic/255126-calling-curl-repeatedly-error/ Share on other sites More sharing options...
ansharma Posted January 16, 2012 Author Share Posted January 16, 2012 solved problem arised because of additional white space in url $urlval = str_replace("href=","",$urlval); $urlval = trim(str_replace("'","",$urlval)); echo $urlval.'<br>'; pager($urlval); Quote Link to comment https://forums.phpfreaks.com/topic/255126-calling-curl-repeatedly-error/#findComment-1308104 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.