papaface Posted December 10, 2009 Share Posted December 10, 2009 Hey, I am about to go insane so please can someone come to my aid lol. My code: function download($url) { $curl = curl_init(); if($curl) { if( !curl_setopt($curl, CURLOPT_URL, $url) ) return "FAIL: curl_setopt(CURLOPT_URL)"; if( !curl_setopt($curl, CURLOPT_HEADER, array("Accept: text/xml,application/xml,application/xhtml+xml,text/html,;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5", "Accept-Language: en-us,en;q=0.5", "Connection: keep-alive", "User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.4) Gecko/20070625 Ubuntu/7.10 (gutsy) Firefox/3.0.0.7", "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7", "Keep-Alive: 300")) ) return "FAIL: curl_setopt(CURLOPT_HEADER)"; $ret = curl_exec($curl); if( !$ret ) return "FAIL: curl_exec()"; curl_close($curl); if (strpos($ret, "Payment Required") > 0) { return "Payment is required <br />"; } else { return $ret; } } else return "FAIL: curl_init()"; } Sample of cURL output: HTTP/1.1 402 Payment Required Date: Thu, 10 Dec 2009 Why would that show when I am asking it to return "Payment is required <br />" if the $ret var contains the string "Payment Required"? Any help would be appreciated 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.