我正在使用Shopify PHP API。没有变音符号的产品工作正常,并被添加。当我尝试发送带有捷克变音符号 (ěščřžýáíé) 的产品时,会显示错误:
Fatal error: Uncaught exception 'ShopifyApiException' with message
'Unprocessable Entity' in C:\webdev\www\shopify-api-doporucene\shopify.php on line 32
ShopifyApiException: Unprocessable Entity in C:\webdev\www\shopify-api-doporucene\shopify.php on line 32
我在本地主机上使用 Wamp。我试过json_encode
了,但它不起作用。有谁知道我该如何解决这个问题?
我的 PHP 代码(此示例中删除了 API 密钥):
require 'shopify.php';
$shops_myshopify_domain = "hyatt-ryan2200.myshopify.com";
$api_key = "";
$shared_secret = "";
$shops_token = "";
// For regular apps:
$shopify = shopify_api_client($shops_myshopify_domain, $shops_token, $api_key, $shared_secret);
$newproduct = array
(
"product"=>array
(
"title"=>"Product title (works fine without diacritics)",
"body_html"=>"Super Duper Plan",
"vendor"=>"Vendor",
"product_type"=>"Test"
)
);
// All requests accept an optional fourth parameter, that is populated with the response headers.
$senditem = $shopify('POST', '/admin/products.json', $newproduct, $response_headers);