SoundCloud API:我无法解码Json数据

时间:2013-01-16 14:58:18

标签: php json zend-framework curl soundcloud

我对SounCloud PHP包装器有疑问。当我向SounCloud 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_decode函数时,它无法解码JSON部分。 有没有人知道如何从这个内容中删除标题?

注意:我在代理服务器后面工作,所以我在下面添加了这段代码,以使curl请求正常工作

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

1 个答案:

答案 0 :(得分:0)

那很奇怪!你能做的是:

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