You are here: cURL changes passed post fields « PHP Programming Language « IT news, forums, messages
cURL changes passed post fields

Posted by gentleJuggernaut on 12/05/07 15:45

I am using curl to access a webservice. The webservice offers a
search and confirm. The search works great. on the confirm there is
a value that needs to be passed back to the webservice in order to
confirm. This value often contains '+%20' etc. Curl appears to be
changing these values to spaces. Is there a curl option that will
tell it not to encode the data, just pass it as is.

Here is the cURL code that I am working with:

$ch = curl_init ();
$fp = @fopen('out.txt','w');
$postdata = 'serviceRequest=' . $xml;
curl_setopt ($ch, CURLOPT_URL,$this->getGateway($test));
curl_setopt ($ch, CURLOPT_TRANSFERTEXT,true);
curl_setopt ($ch, CURLOPT_POST, true);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_VERBOSE, true);
curl_setopt ($ch, CURLOPT_TIMEOUT, $this->getTimeout($test));
@curl_setopt ($ch, CURLOPT_STDERR, $fp);
$result = curl_exec ($ch);
curl_close($ch);
@fclose($fp);

the variable $xml contains my well formed xml request (I have verified
this separately). When the server (represented by $this-
>getGateway($test)) receives my xml statement with altered text (when
I compare what the server receives with what I had prior to putting it
through cURL some of the data contained in the xml has been
reformatted with spaces in place of certain characters, referenced
above). This of course causes the confirmation to fail. Any help
would be appreciated.

NSM

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация