By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,852 Members | 2,123 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,852 IT Pros & Developers. It's quick & easy.

cURL Post through proxy

TheMadMidget
P: 98
I'm trying to using cURL to send a Post variable and through a proxy server. I know how to send requests through a proxy server or how to do post variables. I tried to combine them, but it doesn't work. The code I'm posting work as it should if I comment out either the proxy or the two post lines, but not as is.

[PHP]
$ch = curl_init("http://mysite.com");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_PROXY, "myproxyip");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "field=value");
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$data = curl_exec ($ch);
curl_close($ch);

print $data;
[/PHP]
May 21 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.