mraza Posted January 22, 2011 Share Posted January 22, 2011 hi today i was checking a site as i m learning more about curl. i see i was not able to get image with curl. they have stopped hotlinking and was not finiding anyway to show me image on my localhost so making this thread for any pro help. here is my code: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.pixhost.org/show/2019/5530476_banner.png"); curl_setopt($ch, CURLOPT_USERAGENT, "Opera/9.80 (Windows NT 5.1; U; en) Presto/2.5.24 Version/10.54"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_COOKIE, 'pixhostads=1'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec ($ch); echo $result ; if i run that script it will show me that page but it says pictures is hotlinked and cant display, so i tried to see cookie but i m not sure if i am doing it right. on that url u must need to click "Click to continue" before u can see image. Please can someone help why its not showing me the correct image and any way to pass it? thanks Link to comment https://forums.phpfreaks.com/topic/225312-setting-cookie-in-curl-does-not-work/ Share on other sites More sharing options...
BlueSkyIS Posted January 22, 2011 Share Posted January 22, 2011 http://www.google.com/search?client=safari&rls=en&q=php+curl+cookie&ie=UTF-8&oe=UTF-8 Link to comment https://forums.phpfreaks.com/topic/225312-setting-cookie-in-curl-does-not-work/#findComment-1163613 Share on other sites More sharing options...
ManiacDan Posted January 22, 2011 Share Posted January 22, 2011 You can also look up Snoopy, it's a PHP class that masquerades as a browser. It handles cookies, redirects, and user-agent for you. -Dan Link to comment https://forums.phpfreaks.com/topic/225312-setting-cookie-in-curl-does-not-work/#findComment-1163698 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.