Php SoundCloudAPI:我可以';t解码Json数据

Php SoundCloudAPI:我可以';t解码Json数据,php,json,zend-framework,curl,soundcloud,Php,Json,Zend Framework,Curl,Soundcloud,我对Sounclud PHP包装器有一个问题。当我向SounClud API发出oembed请求时。最后一个给了我一个字符串数据。它由头和JSON数据组成。看起来是这样的: Age: 0 Via: 1.1 varnish X-Cache: MISS Vary: Accept-Encoding {"version":1.0,"type":"rich",......."author_url":"https://soundcloud.com/forss"} 因此,当我对该数据使用json\u de

我对Sounclud PHP包装器有一个问题。当我向SounClud API发出oembed请求时。最后一个给了我一个字符串数据。它由头和JSON数据组成。看起来是这样的:

Age: 0
Via: 1.1 varnish
X-Cache: MISS
Vary: Accept-Encoding

{"version":1.0,"type":"rich",......."author_url":"https://soundcloud.com/forss"}
因此,当我对该数据使用
json\u decode
函数时,它无法解码json部分。 有人知道如何从这个内容中删除标题吗

注意:我在一个代理后面工作,所以我在下面添加了这段代码以使curl请求工作

$client->setCurlOptions(array(
            CURLOPT_FOLLOWLOCATION => 1,
        CURLOPT_PROXY => "http://xxxxxxxxxx",
        CURLOPT_PROXYPORT => 8080,
        CURLOPT_PROXYUSERPWD => "xxxx:xxxx",
        CURLOPT_SSL_VERIFYPEER => 0));

真奇怪!您可以做的是:

if(strstr($response, "{") !== false){
    $response = substr($response, strstr("{"));
}

谢谢我已经将CURLOPT_HEADER设置为false,并在soundcloud php包装器上添加了一些修复行:if(array_key_exists(CURLOPT_HEADER,$options)&&!$options[CURLOPT_HEADER])$this->lastHttpResponseBody=$data;else$this->_lastHttpResponseBody=substr($data$info['header\u size']);