mulysa Posted December 4, 2006 Share Posted December 4, 2006 I want to go hotlink to some URL which protected by checking HTTP_REFERER.Then I begin to code like this.But I got an error as shown at the bottom.Don't know why this happen.mydownload.php[code]<?if($_POST['url']==""){?><html> <form method="post" action="mydownload.php" target="download"> <table bgcolor="#ffffff"> <tr><td colspan="2" nowrap="nowrap" valign="top" align="left" height="32"> <br/> <input name="url" type="text" size="64" value=""></input> </td></tr> <tr><td valign="top" align="left"> <input type="submit" value="Download"></input> </td> </tr></table> </form></html><?}else {$hackurl= htmlentities($_POST['url']);$opts = array( 'http'=>array( 'method'=>"POST", 'header'=>"Accept-language: en\r\n" . "Host:http://somewhere.com\r\n". "Referer:http://somewhere.com\r\n ". "Content-type: application/x-www-form-urlencoded\r\n" ));$fullurl="http://somewhere.com/download.php?url=".$hackurl;$context = stream_context_create($opts);$fp = fopen($fullurl, 'r', false, $context);fpassthru($fp);fclose($fp);}?>[/code]Here the error I got[code]Warning: fopen() [function.fopen]: php_network_getaddresses: getaddrinfo failed: No such host is known. in D:\xampplite\htdocs\mydownload.php on line 45Warning: fopen(http://somewhere.php/download.php) [function.fopen]: failed to open stream: No error in D:\xampplite\htdocs\mydownload.php on line 45Warning: fpassthru(): supplied argument is not a valid stream resource in D:\xampplite\htdocs\mydownload.php on line 46Warning: fclose(): supplied argument is not a valid stream resource in D:\xampplite\htdocs\mydownload on line 47[/code] Link to comment https://forums.phpfreaks.com/topic/29416-help-fopen-and-http_referer/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.