Hoping someone can point me in the right direction. I have a URL that redirects to a media file. That is the information I am trying to retrieve. (The host and the path of the actual file).
Using this code
<?php
$url='http://urs.pbs.org/redirect/71201be9214242cbbc32633826f8092b';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_exec($ch);
$newurl=curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
$p = parse_url($newurl) ;
$rtmp=$p['scheme']."://".$p['host'];
$episode=$p['path'];
echo $rtmp.'<BR>';
echo $episode.'<BR>';
?>
Locally, it works fine. But on my production server is just kicks back the $url.
It prints out http://urs.pbs.org /redirect/71201be9214242cbbc3233826f8092b
Also, I should point out that CURL is installed on the production server and working fine. I am not getting any errors.
Any help appreciated.