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;
?>