我想通過PHP發佈數組for api。我爲此使用了oAuth 1.0,但是如何使用oAuth來POST JSON體數組。我如何使用oAuth1.0 POST POST JSON body數組/ php
<? php
//code start
try
{
$postData = array(
'ProductID' => $productID,
'InventoryType' => $InventoryType,
'ProductCostPrice' => $productCost
);
$postData = json_encode($postData);
$oauth = new OAuth($this->consumer_key, $this->consumer_secret);
$oauth->enableDebug(); // simple debug flag for checking error messages
$oauth->disableSSLChecks(); // avoids an SSL issue when testing
$oauth->setToken($this->access_token, $this->token_secret);
## POST JSON body array ##
$oauth->setBody('body',$postData);
##
$url = $this->product_update_url.$productID;
$oauth->fetch($url, OAUTH_AUTH_TYPE_FORM);
$response_info = $oauth->getLastResponseInfo();
header("Content-Type: {$response_info["content_type"]}");
$dataList = (array) json_decode($oauth->getLastResponse());
echo "<pre>";
print_r($dataList);
echo "</pre>";
exit;
} catch(OAuthException $E) {
Mage::log('error', null, 'error.log');
}
==================
網址:http://php.net/manual/en/class.oauth.php
請你能幫助,怎麼可以用我張貼JSON體陣列的OAuth。