Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Pinterest API-纯json响应?_Php_Json_Api_Pinterest - Fatal编程技术网

Php Pinterest API-纯json响应?

Php Pinterest API-纯json响应?,php,json,api,pinterest,Php,Json,Api,Pinterest,因此,我向Pinterest的API发出了一个简单的HTTP请求,以获取链接的计数: $this->load->library('rest'); $this->rest->initialize(array('server' => 'http://api.pinterest.com/')); $return_data = $this->rest->get('v1/urls/count.json?callback=&url=' . $link);

因此,我向Pinterest的API发出了一个简单的HTTP请求,以获取链接的计数:

$this->load->library('rest');
$this->rest->initialize(array('server' => 'http://api.pinterest.com/'));
$return_data = $this->rest->get('v1/urls/count.json?callback=&url=' . $link);
我得到的答复是:

receiveCount({"count": 5743, "url": "http://google.com"})
你可以

我不想要回调,我尝试设置
callback=
,但括号仍然存在,因此无法通过
json\u decode
解析它


有没有更好的方法来获得纯json响应而不必自己用字符串替换括号?

Pintrest API目前正在开发中,尚未准备好供公众使用;他们不久前删除了自己的文档。但是,API的v2上有一个缓存

现在我只需要对响应执行正则表达式,例如

$return_data = preg_replace('/^receiveCount\((.*)\)$/', "\\1", $return_data);

然后对其进行解码。

感谢Matt,我甚至没有检查他们的API是否处于开发模式。我要坚持到底!