My-Proxy Forum

Proxy Help => Proxy Questions => Topic started by: webzavoda on July 28, 2009, 09:12:06 AM

Title: how do i access some site through proxy on PHP?
Post by: webzavoda on July 28, 2009, 09:12:06 AM
I need access on some site (liveInternet.ru, yandex.ru etc.) through proxy.
When i tune my browser to use proxy, it all works ok.
But whence i try to do the same thing in php script, i get this message:
 
Code: [Select]
Access to our service is forbidden!
You try to access www.yandex.ru from IP-adress xxx.xxx.xxx.xxx.
 
This could be an open proxy-server. This means, everyone can use it with no responsibility at all.
We have to forbid the access trhough proxy-servers, since they're oftenly used to attack us or our users.

Here is my script, it is really simple:

Code: [Select]
$address = "xxx.xxx.xxx.xxx";
$port = "80";
$fp=fsockopen($address,$port);
if($fp) {
fputs ($fp, "GET http://yandex.ru/yandsearch?text=$inquiry HTTP/1.1\r\n");
 
fputs ($fp, "Host: yandex.ru\r\n");
fputs ($fp, "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11\r\n");
fputs ($fp, "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n");
fputs ($fp, "Accept-Language: ru,en-us;q=0.7,en;q=0.3\r\n");
fputs ($fp, "Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7\r\n"); fputs ($fp, "Keep-Alive: 300\r\n");
fputs ($fp, "Connection: keep-alive\r\n\r\n");
 
while (!feof($fp)) {
echo fgets ($fp,128);
}
fclose ($fp);
}

I took the header strings from LiveHTTPHeaders plugin. How do I get hoocked, if I can access the site with my browser through the same proxy, using the same headers?
thanx.
Title: Re: how do i access some site through proxy on PHP?
Post by: Terry on July 29, 2009, 01:03:17 AM
The proxy you used is already in the database of yandex.ru so it denied your search request.
You can try other proxies that yandex doesn't know.
Title: Re: how do i access some site through proxy on PHP?
Post by: webzavoda on July 29, 2009, 08:15:35 AM
When i tune my browser to use proxy, it all works ok.
- ??
Title: Re: how do i access some site through proxy on PHP?
Post by: Terry on July 29, 2009, 10:11:09 PM
Quote
When i tune my browser to use proxy, it all works ok.
Did you search any word on yandex using the proxy?
Title: Re: how do i access some site through proxy on PHP?
Post by: webzavoda on July 30, 2009, 03:42:55 AM
Quote
When i tune my browser to use proxy, it all works ok.
Did you search any word on yandex using the proxy?
well, yes. in fact i do. both in browser and on php.
Title: Re: how do i access some site through proxy on PHP?
Post by: webzavoda on July 30, 2009, 03:55:47 AM
(http://arendakrasnogorsk.narod.ru/proxytest00.gif)
 - yandex can't detect my browser under proxy (it sais i'm from mehico), either ff and ie do allright.
..yet it somehow detects my php access attempt.
Title: Re: how do i access some site through proxy on PHP?
Post by: Terry on July 30, 2009, 10:04:56 PM
It may because your script did not simulate the browser perfectly so yandex can know you are not using a browser.