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

Please heeeelp - CURL lib appends "0" to all output

P: n/a
Hi All,

I'm using the wonderful CURL lib to handle data between php-scripts in
the background. However, I am experiencing a problem: Whenever the
processed data is returned for output I see a '0' (zero) appended to
I seem to be unable to get rid of it. I don't even know where this
zero comes from and why it is there. Any help greatly appreciated.

A simple example:

Script 1 handles some data (e.g. some form input) and sends it to
script 2.

Script 2 then processes the data and generates the output.

Here is a live demo which produces the output "test output". Just
click the following link and note the appended "0":

Script 1 looks like this:

$url = "";
$test_value = "test output";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"$url");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "test_value=$test_value");
curl_exec ($ch);
curl_close ($ch);

Script 2 looks like this:

$test_value = $_POST[test_value];
echo $test_value;
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.