到目前为止,我已使用此代码:-
<?php
$url = "http://localhost/wordpress/wc-api/v3/orders?oauth_consumer_key='cs_ffd1bf17f1d66526ebd12e5ad9cf24c986a93dc5'&oauth_timestamp=".time();
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: multipart/form-data"));
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
$arrResult = json_decode($result, true);
echo "<pre>";
print_r($arrResult);
但是我遇到了错误
{“错误”:[{“代码”:“ woocommerce_api_authentication_error”,“消息”:“缺少oauth_signature参数”}]}
我不了解 oauth_signature 。
答案 0 :(得分:0)
您需要使用oauth客户密钥生成签名,详细步骤可在此处找到:
http://woocommerce.github.io/woocommerce-rest-api-docs/#authentication-over-http