ويمكنك عمل ذلك ايضا اذا كان مستضيفك يدعم ال curl
كود PHP:
<?php
$url = $_GET['site'];
if(function_exists("curl_init"))
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$data = curl_exec($ch);
curl_close ($ch);
}
if(!eregi('Location: ', $data)) {
echo 'هذه الوصله لن تنقلك لاى مكان';
} else {
preg_match("/Location: (.+)/", $data, $matches);
$location = $matches[1];
echo 'هذه الوصله ستنقلك الى "'. $location.'"';
}
?>
للاستخدام
http://yoursite.com/file.php?site=ht...go.cgi?ID=4823