Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 10-19-2007, 07:22 PM   #1
qw12er
Confirmed User
 
Join Date: Apr 2004
Location: Montreal
Posts: 799
:stoned PHP Guru - need your help

How can I force an HTTP GET request through a proxy server with PHP ?

Right now I use this function to send my info :
function myPost($URL, $script, $data){

$sock = fsockopen($URL, 80, $errno, $errstr);
fputs($sock, "GET ".$script." HTTP/1.0\r\n");
fputs($sock, "Host:".$URL."\r\n");
fputs($sock, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($sock, "Content-length: " . strlen($data) . "\r\n");
fputs($sock, "Accept: */*\r\n");
fputs($sock, "\r\n");
fputs($sock, "$data\r\n");
fputs($sock, "\r\n");
fclose($sock);
}

Thanks for any help !
__________________
I have nothing to advertise ... yet.
qw12er is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-19-2007, 10:43 PM   #2
qw12er
Confirmed User
 
Join Date: Apr 2004
Location: Montreal
Posts: 799
bump 8 char
__________________
I have nothing to advertise ... yet.
qw12er is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-19-2007, 11:23 PM   #3
CyR
Registered User
 
Join Date: Sep 2002
Posts: 50
fputs($sock, "Host:".$URL.":8080\r\n");

Missing port ? Other than that I can't see much wrong, although I'm tired and can't think straight atm >_<
CyR is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-19-2007, 11:30 PM   #4
qw12er
Confirmed User
 
Join Date: Apr 2004
Location: Montreal
Posts: 799
no the function is working fine but it's not going through a proxy as it is.

I guess my question should be more like how do you interact with a proxy in php. Can't find much doc on this subject ...
__________________
I have nothing to advertise ... yet.
qw12er is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-19-2007, 11:30 PM   #5
GrouchyAdmin
Now choke yourself!
 
GrouchyAdmin's Avatar
 
Industry Role:
Join Date: Apr 2006
Posts: 12,085
Here, I'll save you some time. Rewrite for cURL. It'll save you many, many, many headaches.

Code:
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $requestUrl);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_TIMEOUT, 'timeout_in_seconds');
     curl_setopt($ch, CURLOPT_PROXY, 'proxy_ip:proxy_port');
     $data = curl_exec($ch);
     curl_close($ch);
__________________
GrouchyAdmin is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-19-2007, 11:36 PM   #6
GrouchyAdmin
Now choke yourself!
 
GrouchyAdmin's Avatar
 
Industry Role:
Join Date: Apr 2006
Posts: 12,085
Quote:
Originally Posted by qw12er View Post
I guess my question should be more like how do you interact with a proxy in php. Can't find much doc on this subject ...
See my following answer. Writing fsock code to do posting is both deprecated, and painful. Trying to make it nest multiple levels for proxy CONNECT statements, et al, is just asinine when there already exists the functionality.
__________________
GrouchyAdmin is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-20-2007, 12:12 AM   #7
qw12er
Confirmed User
 
Join Date: Apr 2004
Location: Montreal
Posts: 799
Thanks ! Does the job perfectly !
__________________
I have nothing to advertise ... yet.
qw12er is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.