file_get_contents() Help. Connect 2 web page 2 view source.
Posted: Thu Sep 14, 2006 10:03 pm
feyd | Please use
Thank you for any and all help.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hie. I'm trying to get a script I wrote to work. I want it to take the clients ip address and then try and connect to that ip address on port 80. After it has connected I want it to search (assuming it does) through the source code on the page for keywords.
I will use an example to try an explain the problem. Say a user connects to my page by going through the proxy at http://www.dtunnel.com/ . My script tries to connect on port 80 with the ip address that connected to it, 66.90.73.132 . But when it connects to http://66.90.73.132/ it does not see the page thats at http://www.dtunnel.com/ but insteas a Cpanel message saying "There is no website configured at this address."
When I do a DNS lookup on http://www.dtunnel.com I get 4 ip addresses and none of them match the one my script recieved.
My question is why are the two pages different, and how can I modify my code to connect to the page hosting the site and not the one giving the odd message?
Here is the code for this part of the script. The whole script is at http://testing.xeepo.com/source.php, and an example of the script in action is at http://testing.xeepo.com/test2.php (its a little slow :-).Code: Select all
//Try to connect to remote host on port 80 and view html...
$htm = false;
$htm = file_get_contents('http://' . $_SERVER['REMOTE_ADDR']);
if ($htm === false) {
} else {
print "<p>Service running on remote host...</p><p>Looking for more signs of a proxy...</p>";
}
$checkforinfo1 = false;
$checkforinfo2 = false;
$checkforinfo3 = false;
$checkforinfo4 = false;
$checkforinfo1 = strpos($htm, "Remove all cookies");
$checkforinfo2 = strpos($htm, "Remove all scripts");
$checkforinfo3 = strpos($htm, "Remove ads");
$checkforinfo4 = strpos($htm, "Hide referrer information");
if (($checkforinfo1 === false) && ($checkforinfo2 === false) && ($checkforinfo3 === false) && ($checkforinfo4 === false)) {
} else {
$proxy = 'test';
print "<p>Connected to proxy...</p>";
}feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]