php - 404 not found in curl -


i have been searching answer here 404, i'm not lucky solve problem. have same problem in previous post. copy , paste answer no luck again.

here's code

$ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_useragent,"mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.8.1.1) gecko/20061204 firefox/2.0.0.1" ); curl_setopt($ch, curlopt_followlocation, false); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_ssl_verifypeer, false); $raw_data = curl_exec($ch); curl_close($ch);  var_dump($raw_data); 

i don't know if have right code in curl. if paste url in browser, result. there need configure or set in server? don't know cause of this. need involve server personnel check on this? hoping advice here. i'm new of this.

curl_setopt($ch, curlopt_followlocation, false); prevents curl following redirects. therefore, if url redirected (from http https, domain.com www.domain.com, etc.), won't work.

the browser, however, redirect you. try changing line curl_setopt($ch, curlopt_followlocation, true);, should help!


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -