I getting error upon submitting a post request using cURL. So far i have this code:
$login_url = 'http://192.168.1.1/login';
$postArr = array(
'username'=>'username',
'password'=>'password',
'dst' => base_url().'login/home'
);
$this->curlPost($login_url, $postArr);
function curlPost($url, $data){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: application/x-www-form-urlencoded"));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($ch);
curl_close ($ch);
echo 'using curl --- '.$url.'<br />';
var_dump($server_output);
}
Basically, this code should do POST username and password to specific url, but unfortunately it is returning "Error 501: Not Implemented" my server is wamp. Anyone have idea what is causing this issue? Thanks