-1

Please help me regarding this issue , if you goto

https://graph.facebook.com/BillGates/picture?type=large

it will redirect to following link:

https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xfa1/t1.0-1/c10.10.130.130/181592_10150105700371961_7986881_n.jpg

how can i write a function that get first link as input and echo second link as output ?

aidinMC
  • 1,415
  • 3
  • 18
  • 35
  • possible duplicate of [php get url of redirect from source url](http://stackoverflow.com/questions/17472329/php-get-url-of-redirect-from-source-url) – esqew Jun 23 '14 at 16:08
  • I tried second answer but not work for me :( – aidinMC Jun 23 '14 at 17:37

1 Answers1

0

try this

`$url = 'https://graph.facebook.com/BillGates/picture?type=large';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$exec=curl_exec($ch);
$redirect_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
echo $redirect_url;`
  • it's load the second link content , if you save loaded content as jpg , understand what's happened ! but it's useful for me thanks :) – aidinMC Jun 23 '14 at 18:31