Equivalent of PostMethod of Java in PHP -


i ask if there exists php function simulate block of code in codeigniter.

httpclient httpclient       = new httpclient(); postmethod postmethod       = new postmethod(requesturl); namevaluepair[] datas       = {new namevaluepair("studentnumber", studentnumber),                                new namevaluepair("studentdata", encrypteddata)};  postmethod.setrequestbody(datas); int statuscode      = httpclient.executemethod(postmethod); byte[] responsebyte = postmethod.getresponsebody(); string responsebody = new string(responsebyte, "utf-8"); 

curl doesn't seem work, while $this->output->set_output passes data fails catch response of requesturl.

thank you.

i able catch response requesturl using block of code found on http post php, without curl (thanks lot this).

$options = array(     'http' => array(         'method' => "post",         'header' => "accept-language: en\r\n" . "content-type: application/x-www-form-urlencoded\r\n",         'content' => http_build_query(array(             'studentnumber' => $studentnumber,             'studentdata' => $encrypteddata,         ),'','&'     ) ));  $refno = file_get_contents($requesturl,false,$context); 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -