1
獲取JSON這是擺脫與Zend的URL的JSON響應的正確方法是什麼?我想要的方式來從Instagram的API信息(http://instagram.com/developer/authentication/)與Zend
public function getAccessToken($code) {
$config = Zend_Registry::get('config');
$client = new Zend_Http_Client('https://api.instagram.com/oauth/access_token');
$client->setMethod(Zend_Http_Client::POST);
$client->setParameterPost('client_id', $config['social']['instagram']['client_id']);
$client->setParameterPost('client_secret', $config['social']['instagram']['client_secret']);
$client->setParameterPost('grant_type', 'authorization_code');
$client->setParameterPost('redirect_uri', $config['social']['instagram']['redirect_uri']);
$client->setParameterPost('code', $code);
$body = $client->request();
return $body->getBody();
}
我只是得到一個奇怪的反應,是這樣的:
string '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Instagram</title>
<meta name = "viewport" content = "width = 320px">
<link rel="stylesheet" href="/static/styles/master-new.css?1" type="text/css" media="screen" title="no title" charset="utf-8">
</head>
<body>
<div id="wrap" class="grid-all group">
<div style'... (length=726)
任何想法?我在Zend是一個小菜鳥順便說一句,所以請確保你想想很明顯也:)
您好,感謝您的回答,但是這不是問題,價值觀都很好,其實如果我故意將它們中的一個錯誤我得到它是不正確的Instagram的消息 – luqita