I made a PHP curl page that works ok, but with some URLs it gives me an "Object Moved, This document may be found here" with a link to go to the site the original URL is forwarding to.. so my question is how can i make the php page get that new URL & then curl it..??
i already have that in my code, but it don't seem to be working though..?? Code: <?php $Link = $_SERVER['QUERY_STRING']; $uri = parse_url($Link); $base = "http://".$uri[host].""; echo geturl($Link, $base); function geturl($url, $referer) { $headers[] = 'Accept: image/png, image/gif, image/x-bitmap, image/jpeg, image/pjpeg'; $headers[] = 'Connection: Keep-Alive'; $headers[] = 'Content-type: application/x-www-form-urlencoded;charset=UTF-8'; $UserAgent = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)'; $process = curl_init($url); curl_setopt($process, CURLOPT_HTTPHEADER, $headers); curl_setopt($process, CURLOPT_HEADER, 0); curl_setopt($process, CURLOPT_USERAGENT, $UserAgent); curl_setopt($process, CURLOPT_REFERER, $referer); curl_setopt($process, CURLOPT_TIMEOUT, 60); curl_setopt($process, CURLOPT_RETURNTRANSFER, 1); curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1); $return = curl_exec($process); curl_close($process); return $return; } ?>
CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set. If you have access to your php configuration (php.ini) set : Code: open_basedir none safe_mode off Hope that helps!