简体   繁体   中英

How get json value from php curl response

want to access the value of access_token only from the following response

HTTP/1.1 200 OK Date: Sat, 16 Nov 2019 16:04:10 GMT Content-Type: 
application/json;charset=UTF-8 Content-Length: 113 Connection: keep-alive 
Cache-Control: no-store { "access_token": "lhQSuhRdTuU9MFceGgnl5Lqaqx08", 
"expires_in": "3599" }

Most probably you have the option CURLOPT_HEADER set to 1 . This has the effect of including the response HTTP headers into the result of curl_exec() .

Just set CURLOPT_HEADER to 0 . That should do it.

More info: https://curl.haxx.se/libcurl/c/CURLOPT_HEADER.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM