php - Woocommerce product api not accept images in some urls -
i creating products external in woocommerce site. code 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 http://app.test.net:8080/test/img/company-logo.png gives following error:
php fatal error: uncaught exception 'wc_api_client_http_exception' message 'error: error getting remote image
but if give normal url(url not contain specific port) such http://test.com/wp-content/uploads/2016/02/test.png it's working properly.
how resolve this?
in case above mentioned code in such url (http://app.test.net:8080/api/v1/product.php). calling api .net application (http://appname.test.net). both having same domain part (test.net).
there fore difficult find url woo commerce.i have change url of .net application server configuration(i have using virtual hosts).then works properly.
Comments
Post a Comment