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);
?>
Curl POST puts character "0" on screen
Moderator: General Moderators
- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact:
curl_exec creats output
should work..
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);
?>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