php - Trying to get json from get request http authenticated -
i'm trying data api protected http authentication. i'm want response json, i'm getting string innstead. can fix this?
this code:
//init curl $ch = curl_init(); $process = curl_init($url."?".$querystring); curl_setopt($process, curlopt_httpheader, array('content-type: application/json', '')); curl_setopt($process, curlopt_header, 1); curl_setopt($process, curlopt_userpwd, $username . ":" . $password); curl_setopt($process, curlopt_timeout, 30); curl_setopt($process, curlopt_post, 1); curl_setopt($process, curlopt_postfields, ''); curl_setopt($process, curlopt_returntransfer, true); $return = curl_exec($process); print_r($return);
Comments
Post a Comment