Web Hosting Talk







View Full Version : referrer


Ferman
03-26-2005, 04:20 PM
Hi,

I need a php code:

code will open the address written on the first box and send the url written on the second box as a referrer to the visited website

Could you help me please,

Regards,
Ferman

Jason.NXH
03-26-2005, 06:10 PM
Do you have the HTML code? Otherwise I can write out the PHP script, and you would have to edit it yourself

Ferman
03-26-2005, 06:20 PM
html code is ok
ferman.net/test.php

I have taken help from another guy. But this script gives error, because it is php5 compatible and my server support php4

<html>
<head>
<title>Test</title>
</head>
<body>
<form method="get" action="test.php">
Site: <input type="text" name="site" value="" />
<br />
Referer: <input type="text" name="ref" value="" />
<br />
<input type="submit" />
</form>
<?php
if(!empty($_GET['site']) && !empty($_GET['ref']))
{
echo '<hr>Result: ';

$opts = array('http'=>array('method'=>'GET','header'=>"Referer: {$_GET['ref']}\r\n"));
$context = stream_context_create($opts);

$page = file_get_contents($_GET['site'],FALSE,$context);
echo htmlentities($page);
}
?>
</body>
</html>

Ferman
03-27-2005, 09:03 PM
Could someone help me please?

Jason.NXH
03-27-2005, 09:11 PM
Here, try this out:

<?php

if ($submit) {
if (!$site) {
echo "No site entered!";
}
if (!$referrer) {
echo "No referrer entered!";
}
if ($referrer & $site) {
header("Location: http://$site");
}
}

?>
<html>
<head>
<title>Form</title>
</head>

<body>
<form name="form1" method="post" action="<?php echo "$PHP_SELF"; ?>">
<p>
Site: http://
<input name="site" type="text" id="site">
</p>
<p>
Referrer:
<input name="referrer" type="text" id="referrer">
</p>
<p>
<input name="submit" type="submit" id="submit" value="Submit">
</p>
</form>
</body>
</html>

Ferman
03-27-2005, 10:53 PM
Hi,

script sends the website address it is running at,not the url written on the referrer box. could you check if i am wrong please? ferman.net/referrer.php

flashget and some other download managers send the referrer you write to the website you want to download a file from
i need a script which does the same thing, send what you write as referrer to the visited website

Jason.NXH
03-27-2005, 10:55 PM
Sorry, I don't understand what you are talking about