I want to get the contents of the url, when I used file_get_contents method it returns HTTP/1.1 301 Moved Permanently. But in browser the link works fine.
I also tried curl function, but it is returns the same problem. The code is
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $page_url);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$a = curl_exec($ch);
if(preg_match('#Location: (.*)#', $a, $r))
$xx = trim($r[1]);
Thanks in advance!