当我尝试在Postman
中运行WooCommerce API时,它向我显示json
的响应,但是当我尝试运行WooCommerce API时,它将显示CURL,它没有任何响应和加载,任何人都可以吗帮我这是什么问题?
$header = array(
'Authorization: Basic Y2tfZmE1NWQ1N2RjNmY1xxxxxx'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://xxxxx.com//wp-json/wc/v3/products/attributes');
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
//curl_setopt($ch, CURLOPT_POST, 0);
//curl_setopt($ch, CURLOPT_POSTFIELDS, "postvar1=value1&postvar2=value2&postvar3=value3");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
if (curl_error($ch)) {
$error_msg = curl_error($ch);
echo $error_msg; die;
}
echo "<pre>";
print_r($server_output);
die;
curl_close($ch);