Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/rest/5.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 magento中不工作rest api中的post方法_Php_Rest_Magento 1.7 - Fatal编程技术网

Php magento中不工作rest api中的post方法

Php magento中不工作rest api中的post方法,php,rest,magento-1.7,Php,Rest,Magento 1.7,我使用这个代码 $headers = array('Content-Type' => 'application/json', 'Accept' => '*/*'); $oauthClient->fetch($resourceUrl, $productData, OAUTH_HTTP_METHOD_POST, $headers); $response = json_decode($oauthClient->getLastResponseInfo()); 但是得到 {"m

我使用这个代码

$headers = array('Content-Type' => 'application/json', 'Accept' => '*/*');
$oauthClient->fetch($resourceUrl, $productData, OAUTH_HTTP_METHOD_POST, $headers);
$response =  json_decode($oauthClient->getLastResponseInfo());
但是得到

{"messages":{"error":[{"code":403,"message":"Access denied"}

有人请帮助我如何使用REST api post方法在magento站点中添加一个简单的产品。

您确定$oauthClient是正确的吗$oauthClient->setToken($_会话['token'],$_会话['secret']);它返回我布尔(真)