I have seen some posts identical but I couldn't yet solve me issue.
try
{
$client = new WC_API_Client($woocommerce['url'],
$woocommerce['consumer_key'],
$woocommerce['consumer_secret'],
array('ssl_verify' => FALSE,
'validate_url' => FALSE,
'debug' => TRUE));
$listOfOrders = $client->orders->get(null, array('status' => 'completed'));
}
catch (WC_API_Client_Exception $e)
{
echo $e->getMessage() . PHP_EOL;
echo $e->getCode() . PHP_EOL;
if ( $e instanceof WC_API_Client_HTTP_Exception )
{
print_r( $e->get_request() );
print_r( $e->get_response() );
}
}
I'm working in a localhost environment and I dunno if that's the problem. I have download the most recent WooCommerce and Wordpress versions.
I thought the problem might be due to the use of localhost
and I changed to my local IP address and did not work either.
I have checked if cURL and JSON are enabled on phpinfo()
and they are.
After copy and paste the link into the browser I get the message
-1
EDIT 1: I went to my hosting, and created a subdomain like http://woocommerce.mydomain.com and the problem persists.