Curl POST puts character "0" on screen

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
corin
Forum Newbie
Posts: 8
Joined: Mon Nov 04, 2002 3:07 am

Curl POST puts character "0" on screen

Post by corin »

I'm using curl to post variables to a script. It works fine, except on the output page I get a character "0" displayed for no apparent reason. If I do a view source, at the end of my script is :

<form blah blah.....
...form>
0




</body>
</html>

If I take the form out of the new page, I don't get this problem. Can anybody help me please. The curl code I'm using is :

<?
$URL="www.mydomain/newpage.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://$URL");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "name=$name & age=$age");curl_exec ($ch);
curl_close ($ch);
?>
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

curl_exec creats output

Code: Select all

<? 
$URL="www.mydomain/newpage.php"; 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL,"http://$URL"); 
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_POSTFIELDS, "name=$name & age=$age");
$curl = curl_exec ($ch); 
curl_close ($ch); 
?>
should work..
corin
Forum Newbie
Posts: 8
Joined: Mon Nov 04, 2002 3:07 am

Post by corin »

Thanks, I've tried your suggestion and unfortunately I get the same result of a bogus 0 appearing. I have managed to pass my variables thro' a form now, by cheating and displaying the users input data for them to check on screen and then either 'go back' or 'continue' (with hidden variables). I would like to get the curl working tho' as it has potential for other stuff - think it's a question of dabbling with my script some more. Cheers
Post Reply