Login Register






Help - PHP Proxy filter_list
Author
Message
Help - PHP Proxy #1
PHP Code:
<?php $url = 'http://www.someblockedsite.com'; //Assume that this site is blocked by your ISP $content = file_get_contents($url); header('Content-type: text/xml'); echo $content; ?>

Well, this code has done what I want to by pass. But my problem is:

Quote: When there are some link say Login.php, register.php, etc link in the page, when I click that those links should still open with the file_get_contents($url);

Sorry for my Bad English!
[Image: coolsignature.gif]
:angel:

Reply

RE: Help - PHP Proxy #2
You might have to perform a str_replace, replacing all instances of "http://www.someblockedsite.com" with your proxy script set to point the blocked domain.

Of course you'll also need to change
Code:
$url = 'http://www.someblockedsite.com';
to
Code:
$url = $_GET['url']
so that you can allow for other sites.
[Image: tumblr_m73y8go3jd1rb7u8co1_500.gif]
Avatars are for faggots.

Reply

RE: Help - PHP Proxy #3
Yes, of course that is what I do if I use GET or POST method.....

The question is in a page we have a link, say http://www.blockedsite.com/login.php, so I want this to be http://localhost/?u=http:////www.blocksi.../login.php

!!!!!!!!!!
[Image: coolsignature.gif]
:angel:

Reply

RE: Help - PHP Proxy #4
Well, this will hurt it if they show their entire url on the page, but a simple str_replace("http://www.blockedsite.com/", "http://localhost/?u=http:////www.blocksite.com/", $url); should work...

There are a few problems with this, it assumes every link starts with "http://www.", and as i said earlier, it will replace anything on the HTML shown...The solution to this would be running a RegEx or XML on it, looking for <a href="*"></a>, and replacing the contents...I'll make something with RegEx (Preg_Replace) in a few for ya...Won't be the best tho Tongue

Edit:
Here is a quick RegEx that i made, I really recommend improving on it, as it's still not fool proof (For example, if there is a class in the Anchor link, then it'll skip over it..., same with id etc etc), I'll make an another version, which uses a function instead of replacing expected stuff, still RegEx with the same problems again.... I highly recommend looking into a HTML/XML Parser to do what you want to do...

PHP Code:
<?php $url = "http://google.com"; $page = file_get_contents($url); $page = preg_replace("#\<a href=\"(.+)\">(.+)</a>#iUs", "<a href=\"http://localhost/?u=$1\">$2 - [Changed]</a>", $page); echo $page; ?>
(This post was last modified: 08-04-2013, 01:12 PM by SLUAST.)

Reply

RE: Help - PHP Proxy #5
(08-04-2013, 01:01 PM)nikey646 Wrote: Well, this will hurt it if they show their entire url on the page, but a simple str_replace("http://www.blockedsite.com/", "http://localhost/?u=http:////www.blocksite.com/", $url); should work...

There are a few problems with this, it assumes every link starts with "http://www.", and as i said earlier, it will replace anything on the HTML shown...The solution to this would be running a RegEx or XML on it, looking for <a href="*"></a>, and replacing the contents...I'll make something with RegEx (Preg_Replace) in a few for ya...Won't be the best tho Tongue

Edit:
Here is a quick RegEx that i made, I really recommend improving on it, as it's still not fool proof (For example, if there is a class in the Anchor link, then it'll skip over it..., same with id etc etc), I'll make an another version, which uses a function instead of replacing expected stuff, still RegEx with the same problems again.... I highly recommend looking into a HTML/XML Parser to do what you want to do...

PHP Code:
<?php $url = "http://google.com"; $page = file_get_contents($url); $page = preg_replace("#\<a href=\"(.+)\">(.+)</a>#iUs", "<a href=\"http://localhost/?u=$1\">$2 - [Changed]</a>", $page); echo $page; ?>


This resolved my problem..You are really food in RegExp.........!

Thanks..
[Image: coolsignature.gif]
:angel:

Reply