Is it possible for PHP to track the url?

Is it possible for PHP to get the URL, wait for the redirect, and then enter the URL of the page?

+4
source share
3 answers
$cr = curl_init("http://example.com"); curl_setopt($cr, CURLOPT_RETURNTRANSFER, true); curl_setopt($cr, CURLOPT_FOLLOWLOCATION, 1); curl_exec($cr); $info = curl_getinfo($cr); echo "url=".$info["url"]; 
+10
source

You can also use wget / curl wrapper.

http://php.net/manual/en/book.curl.php

0
source

All Articles