file_get_contents() Help. Connect 2 web page 2 view source.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rosskinard
Forum Newbie
Posts: 2
Joined: Thu Sep 14, 2006 9:32 pm

file_get_contents() Help. Connect 2 web page 2 view source.

Post by rosskinard »

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>";
}
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]
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Post by Zoxive »

mm, first off http://www.dtunnel.com 's ip is not 66.90.73.132, its '67.159.3.219'..

But anyways whats the reason you want to know if they are on a proxy or not?

What if that person is running a webserver on their home pc, or they happen to be browsing your site from a server?

So now, you acually get the IP+search for 4 specific word strings, what if this particuar proxy had all 3 but missed 1?

Doing all this just see if a user is on a proxy is a waste of the ~10 seconds it takes the page to load.

-NSF
rosskinard
Forum Newbie
Posts: 2
Joined: Thu Sep 14, 2006 9:32 pm

Post by rosskinard »

NonStopableForce wrote:mm, first off http://www.dtunnel.com 's ip is not 66.90.73.132, its '67.159.3.219'..

-NSF
I know, I said that. Thats part of what I don't understand. When I connect to my script from the proxy that is the ip I get and I don't know why.

But anyways whats the reason you want to know if they are on a proxy or not?

For me it is a project for fun. Other people can modify it how they like. Someone might be able to use it for flood control or protecting from people using proxies to try and brute force a login. I'm also interested in finding a proxy that can bypass all of these checks. I've found two that have come close, but no enchilada.

What if that person is running a webserver on their home pc, or they happen to be browsing your site from a server?
Then I want the program to look for signs of a proxy (the keywords).

So now, you acually get the IP+search for 4 specific word strings, what if this particuar proxy had all 3 but missed 1?
Well, if I can get the script to work then I can refine the keywords, and how many of each are neccesary.

Doing all this just see if a user is on a proxy is a waste of the ~10 seconds it takes the page to load.
Thanks for the help.
Post Reply