Http_request with curl
Posted: Fri May 16, 2008 12:15 pm
hi! there i'm trying to build an small system that i can call from anywhere on the web to do a certain action for me.I'm using curl library for that.For testing my logique i created 2 files test.php and test1.php in the same folder,the first as a client and the second which will process some action and return a value that the first file can use.What i see is so weird that i don't even know that i understand
here are they
this is test.php
this is test1.php
and this is what the server display

here are they
this is test.php
Code: Select all
$ch = curl_init("./test1.php");
curl_setopt($ch, CURLOPT_URL,"test2.php");
$param = "jojo";
curl_setopt($ch,CURLOPT_POSTFIELDS,$param);
$i =curl_exec($ch);
curl_close($ch);
echo $i;
Code: Select all
if(isset($_REQUEST['name']))
{
$name = $_REQUEST['name'];
/*$d = new mysqli("localhost","root","mamamia","ajax");
$res=$d->query("INSERT INTO users `user_name` VALUES ('$name')");
echo $res->affected_rows();
$d->close();*/
return $name;
}
$a[one] => 1. $a[two] => 2. $a[three] => 3. $a[seventeen] => 17.