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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -