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
Post a Comment