marc.roberts Posted December 11, 2006 Share Posted December 11, 2006 Is it possible to use cUrl to detect a redirect?ie. cUrl opens http://www.here.com/ and is redirected to http://www.overthere.com/ upon this redirect, cUrl returns something... (doesn't matter what, the url that it was redirected to, the url that it was redirected from, a true etc.)If this is possible, is it also possible to detect if the redirected page is secure or unsecure?Thanks,Marc Link to comment https://forums.phpfreaks.com/topic/30231-detect-redirect-using-curl/ Share on other sites More sharing options...
HuggieBear Posted December 11, 2006 Share Posted December 11, 2006 I believe there's an option within CURL called FOLLOWLOCATION which can be set to allow the object to be redirected. You could try something with that.You could grab the data of a url into a variable, with FOLLOWLOCATION off and then again with it on and then do a string compare. If they're different, you know that a redirect has occurred. This isn't ideal as dynamic content on the page could make it different each time you visit the page, giving the effect of a false positive.RegardsHuggie Link to comment https://forums.phpfreaks.com/topic/30231-detect-redirect-using-curl/#findComment-139005 Share on other sites More sharing options...
marc.roberts Posted December 11, 2006 Author Share Posted December 11, 2006 Thanks, I will look into that. Link to comment https://forums.phpfreaks.com/topic/30231-detect-redirect-using-curl/#findComment-139014 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.