curl
| From: | Wilbert Enserink | Date: | Tue, 22 Apr 2003 08:58:51 +0000 |
| Subject: | curl | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-144789@lists.php.net to get a copy of this message | ||
hi all,
i'm currently busy trying out / finding out about CURL.
In my "sending" script or post script I use curl to send stuff to another script, the
recieving script.
The variables I sent using the query in the url (.php?firstname=myFirstName) do reach the recieving
script.
However I know that you can also send stuff in a variable using curl. I called this variable $var.
My Question: how can I read the content of $var in the recieving script.I mean, what do I do with
it??
It seems like powerfull stuff for recieving XML code for example so I could write a bunch of
functions which could analyze the content of $var, but I just don't know where to start, how to
read the contents of that what is being send to my recieve script. Do I need curl in my recieve
script as well to read the contents of $var?
thx for any tips and clues.
Wilbert Enserink
below is the code of my 2 scripts)
<?php
//this is page test_send.php
$url="http://localhost/testcurl/test_recieve.php";
$firstname="wilbert";
$url=$url."?firstname=$firstname";
$var="variable whatever text";
$var=urlencode($var);
$ch = curl_init ($url);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$var);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_NOPROGRESS, 0);
$result = curl_exec ($ch); // result will contain reply from $url
curl_close ($ch);
?>
<?php
//this is page test_recieve.php
global $firstname;
echo "firstname=$firstname";
?>
-------------------------
Pas de Deux
Van Mierisstraat 25
2526 NM Den Haag
tel 070 4450855
fax 070 4450852
http://www.pdd.nl
info@pdd.nl
-------------------------