Visit the LQ Articles and Editorials section
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 12-17-2007, 09:26 AM   #1
LQ Newbie
Registered: Nov 2006
Location: Latvia
Distribution: Slackware
Posts: 15

Rep: Reputation: 0
PHP: cUrl - post data doesn't go through proxy

I have a problem using PHP built-in cUrl library. I'm trying to send post data through proxy servers, but combination proxy+post data seems not to work. This is the fragment of code:
  $cUrl = curl_init();
  curl_setopt($cUrl, CURLOPT_URL, $requestUrl);
  curl_setopt($cUrl, CURLOPT_POST, 1);
  curl_setopt($cUrl, CURLOPT_POSTFIELDS, $postField.$value);
  curl_setopt($cUrl, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($cUrl, CURLOPT_TIMEOUT, '10');
  curl_setopt($cUrl, CURLOPT_REFERER, $referer);
  curl_setopt($cUrl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20071127 Firefox/');
  curl_setopt($cUrl, CURLOPT_PROXY, $proxy);
When I comment out the proxy section, everything works fine. When I comment out POST section and uncomment proxy, everything also works fine. But I can't get them to work together! What's wrong? May it be a bug? My server configuration:

Apache 2.0.47 (without OpenSSL) on Windows XP
PHP 5.1.6 with built-in cUrl library

I'd really appreciate some help!

Last edited by elvijs; 12-17-2007 at 09:28 AM.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
POST data to PHP code ckoniecny Programming 6 03-02-2006 11:48 PM
PHP Question about POST data BrianK Programming 7 11-26-2005 02:33 PM
php, apache, POST/GET data jhaiduce Linux - Software 0 12-17-2003 05:02 PM
Trouble recognising 'post' data in a php file davee Programming 4 10-20-2003 01:29 PM
php post data sql queries... bulliver Programming 2 01-03-2003 03:18 AM

All times are GMT -5. The time now is 12:08 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration