这是我的代码:
$curl1 = curl_init();
$url = "https://bitbucket.org/api/2.0/repositories/webesian/jobmarkt/pullrequests/";
curl_setopt($curl1, CURLOPT_HTTPAUTH, CURLAUTH_BASIC );
curl_setopt($curl1, CURLOPT_USERPWD, "***:***");
curl_setopt($curl1, CURLOPT_HEADER, true);
curl_setopt($curl1, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($curl1, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl1, CURLOPT_URL, $url);
curl_setopt($curl1, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($curl1);
我的问题是输出变量不仅仅是 json。里面还有一些其他的垃圾。如何从响应中仅提取 json?