I have URL with variables like this example : http:// remotesite.com/index1.php?option=com_lsh&view=lsh&event_id=149274&tid=372536&channel=0
this URL redirect to http://remotesite.com/static/popups/xxxxxxxxxxx.html
xxxxxxxxxxx is the variables from the 1st link, event_id=149274, tid=372536, channel=0
then xxxxxxxxxxx = 1492743725360 and the link will be :
http://remotesite.com/static/popups/1492743725360.html
how to get this link automatically in php from the link http:// remotesite.com/index1.php?option=com_lsh&view=lsh&event_id=149274&tid=372536&channel=0
then i will use the curl function to get the source code of 1492743725360.html
using :
<?php
//Get the url
$url = "http:// remotesite.com/static/popups/1492743725360.html";
//Get the html of url
function get_data($url)
{
$ch = curl_init();
$timeout = 5;
//$userAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US)AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.X.Y.Z Safari/525.13.";
$userAgent = "IE 7 – Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)";
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$html = file_get_contents($url);
echo $html;
?>