pear HTTP_Request vs cURL,which one?
Posted: Wed Apr 30, 2008 6:03 am
hi guys
tring to make an API call by sendind a Request through http.honestly a prefere using the pear HTTP_Request and it seems to be not working.And finally i came back to do curl to mke things actually work.My question is it because i'm ot doing it well or it's not working yet.using php 5.2.5.
here is the code
my qustionis should the address contains "?" at the end like http://someaddress/http/auth? or http://someaddress/http/auth/.
It is saying invalid api_pi stuff as error response.I 've noticed too that i'm hving a probleme on using global variables located in the include file.If i echo them i can see it so i thinking that something is wrong in my codes.As i sais with the curl it is working the the same include file.What do you think?
tring to make an API call by sendind a Request through http.honestly a prefere using the pear HTTP_Request and it seems to be not working.And finally i came back to do curl to mke things actually work.My question is it because i'm ot doing it well or it's not working yet.using php 5.2.5.
here is the code
Code: Select all
include_once('HTTP/Request.php');
//this is the conf file and in it we have an example.$password = "thepassword";
include_once("SMSAPI_conf.php");
$req = &new HTTP_Request("http://someaddress/http/auth");
$req->setMethod(HTTP_RESQUEST_METHOD_POST);
$req->addPostData('api_id',$api_id);
$req->addPostData('user',$user);
$req->addPostData('password', $password);
$req->sendRequest();
$response = $req->getResponseBody();
var_dump($response);It is saying invalid api_pi stuff as error response.I 've noticed too that i'm hving a probleme on using global variables located in the include file.If i echo them i can see it so i thinking that something is wrong in my codes.As i sais with the curl it is working the the same include file.What do you think?