Use fsockopen with proxy
Moderator: General Moderators
-
klevis miho
- Forum Contributor
- Posts: 413
- Joined: Wed Oct 29, 2008 2:59 pm
- Location: Albania
- Contact:
Use fsockopen with proxy
Is it possible to use fsockopen by using a proxy server?
Re: Use fsockopen with proxy
To the question you're asking, no. A proxy server will not help you use fsockopen.
To the question you're trying to ask, yes. Point fsockopen to the proxy and modify your request headers respectively.
To the question you're trying to ask, yes. Point fsockopen to the proxy and modify your request headers respectively.
-
klevis miho
- Forum Contributor
- Posts: 413
- Joined: Wed Oct 29, 2008 2:59 pm
- Location: Albania
- Contact:
Re: Use fsockopen with proxy
Thnx tasairis, but can you give me an example on how to do this?
Re: Use fsockopen with proxy
First learn how to send HTTP requests with fsockopen. Try a search engine.
Then (this is going from memory here) you need to:
- connect to the proxy address and port instead of the destination server
- use the full URL, with protocol and domain and everything, in the GET/POST line
- use a Proxy-Connection: instead of a regular Connection:
Then (this is going from memory here) you need to:
- connect to the proxy address and port instead of the destination server
- use the full URL, with protocol and domain and everything, in the GET/POST line
- use a Proxy-Connection: instead of a regular Connection:
-
klevis miho
- Forum Contributor
- Posts: 413
- Joined: Wed Oct 29, 2008 2:59 pm
- Location: Albania
- Contact:
Re: Use fsockopen with proxy
I did this
$ip = "221.130.7.227"; // proxy IP, change this according to your proxy setting in your IE or NS
$port = 80; // proxy port, change this according to your proxy setting in your IE or NS
$fp = fsockopen($ip,$port); // connect to proxy
fputs($fp, "GET translate_tools Http1.1 Host: http://www.translate.google.com/ User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)");
$data="";
while (!feof($fp)) $data.=fgets($fp,64000);
fclose($fp);
print $data;
Am I missing something here?
$ip = "221.130.7.227"; // proxy IP, change this according to your proxy setting in your IE or NS
$port = 80; // proxy port, change this according to your proxy setting in your IE or NS
$fp = fsockopen($ip,$port); // connect to proxy
fputs($fp, "GET translate_tools Http1.1 Host: http://www.translate.google.com/ User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)");
$data="";
while (!feof($fp)) $data.=fgets($fp,64000);
fclose($fp);
print $data;
Am I missing something here?