I am creating products from external in woocommerce site. My code is like bellow:
if($_POST["Type"] == "CREATE"){
$data = array(
'product' => array(
'title' => $_POST["Title"],
'type' => 'simple',
'regular_price' => $_POST["Regular_price"],
'description' => $_POST["Description"],
'short_description' => $_POST["Short_description"],
'categories' => array(
$_POST['CategoryName']
),
'images' => array(
array(
'src' => $_POST["Image_url"],
'position' => 0
),
array(
'src' => $_POST["Image_url"],
'position' => 1
)
)
)
);
$res = $client->products->create($data);
}
When using $_POST["Image_url"]
such like http://app.test.net:8080/test/img/company-logo.png gives the following error:
PHP Fatal error: Uncaught exception 'WC_API_Client_HTTP_Exception' with message 'Error: Error getting remote image
But if we give a normal url(url do not contain the specific port) such like http://test.com/wp-content/uploads/2016/02/test.png it's working properly.
How to resolve this?