PHP Amazon URL Redirect Check -


i have searched forum & there posts related url redirect verification. e.g. php: check if url redirects?

however codes not working me hence posting details in resolution or point doing wrong?

my requirement:

there 2 amazon url:

url1 (does not redirect): http://www.amazon.in/gp/offer-listing/8184954018/?tag=30061200-21

url2 (redirects): http://www.amazon.in/gp/offer-listing/b00ea0q3pw/?tag=30061200-21

what require verify of these redirects else.

so far have tried following code & few other variation of them yields same result both url1 & url2 above not redirected.

<?php $url="http://www.amazon.in/gp/offer-listing/b00ea0q3pw/?tag=30061200-21"; $ch = curl_init();  curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_timeout, '60'); // in seconds curl_setopt($ch, curlopt_header, 1); curl_setopt($ch, curlopt_nobody, 1); curl_setopt($ch, curlopt_followlocation, 1); curl_setopt($ch, curlopt_returntransfer, 1); $res = curl_exec($ch);      if(curl_getinfo($ch)['url'] == $url){         $status = "not redirect";     }else {         $status = "redirect";     }  echo 'input url: '.$url.'</br>';                  echo 'curl getinfo output url: '.curl_getinfo($ch)['url'].'</br>';                echo 'php code says: '.$status; 

is there error in code or amazon playing :)


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -