By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 1,061 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 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
it.
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:

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

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":
http://ulices.com/curl_test/script1.php

Script 1 looks like this:
=================

<?php
$url = "http://www.ulices.com/curl_test/script2.php";
$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:
=================

<?php
$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.