'staff', 'password' => 'staff!123', ); $data = http_build_query($data); $userAgent = 'Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0'; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); curl_setopt($ch, CURLOPT_REFERER, $_SERVER['SERVER_NAME']); curl_setopt( $ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/x-www-form-urlencoded', ]); //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $result = curl_exec($ch); if (curl_errno($ch)) { echo 'Error: ' . curl_error($ch); } $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE); var_dump($http_status); var_dump($result); $decoded_response_object = json_decode($result); error_log("decoded_response_object:".$decoded_response_object->Token); curl_close($curl); ?>