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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jerry

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

    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":


    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,"$u rl");
    curl_setopt($ch , CURLOPT_POST, 1);
    curl_setopt($ch , CURLOPT_POSTFIE LDS, "test_value=$te st_value");
    curl_exec ($ch);
    curl_close ($ch);
    ?>

    Script 2 looks like this:
    =============== ==

    <?php
    $test_value = $_POST[test_value];
    echo $test_value;
    ?>
Working...