cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Beginners problem - Empty BODY

From: Alex <lol_at_pantani.se>
Date: Sun, 10 Jun 2007 17:59:20 +0200

Sorry, my bad, I forgot to include the "text=" in $text. I'm quite ashamed
right now...

Thank anyway.
----- Original Message -----
From: "Alex" <lol_at_pantani.se>
To: <curl-users_at_cool.haxx.se>
Sent: Sunday, June 10, 2007 5:24 PM
Subject: Beginners problem - Empty BODY

> Hi, I've stumbled upon cURL when I way searching for a way to POST
> variables
> to another site, without the use of forms.
>
> The code I have found looks like this with my modifications:
> -----
> <?php
> $URL="site.com/xxx.php?";
> $username = "username=xxxxx";
> $password = "password=xxxxx";
> $destination = "destination=xxxxx";
> $originatortype = "originatortype=xxxxx";
> $originator = "originator=xxxxx";
> $text = "test";
> $ch = curl_init();
> curl_setopt($ch, CURLOPT_URL,"http://$URL");
> curl_setopt($ch, CURLOPT_POST, 1);
> curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
> curl_setopt($ch, CURLOPT_POSTFIELDS, $username . '&' . $password . '&' .
> $destination . '&' . $originatortype . '&' . $originator . '&' . $text);
> curl_exec ($ch);
> curl_close ($ch);
> unset($username, $password, $destination, $text);
> ?>
>
> It seems to be working well, exept for that it apperantly produces an
> "empty
> body", which the script I'm trying to comunicate with don't accept. How
> can
> I solve this?
>
> Thnx // Alex
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition. Version: 7.5.472 / Virus Database:
> 269.8.13/842 - Release Date: 2007-06-09 10:46
>
>
Received on 2007-06-10