我尝试在在线购物中显示产品描述。但这会显示错误,其他产品详细信息可以在网上购物中显示。
下面是我的编码:
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)) {
$product_id = $row['product_id'];
$product_sku = $row['sku'];
$product_name = $row['prdNm'];
$product_price = $row['product_price'];
$product_category_name = $row['category_name'];
$product_weight = $row['weight'];
$product_image = $row['image'];
// $product_description = $row['description'];//
$product_price = $row['price'];
$product_shipment_type = $row['shipment_type'];
$product_warranty = $row['warranty'];
$product_short_description = $row['short_description'];
}
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.11street.my/rest/prodservices/product",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "<?xml version=\"1.0\" encoding=\"UTF-8\"
standalone=\"yes\"?>
<Product>
<selMthdCd>01</selMthdCd>
<dispCtgrNo>4932</dispCtgrNo>
<prdTypCd>01</prdTypCd>
<prdNm>$product_name</prdNm>
<prdStatCd>01</prdStatCd>
<prdWght>$product_weight</prdWght>
<minorSelCnYn>Y</minorSelCnYn>
<prdImage01>$product_image</prdImage01>
//<htmlDetail>$product_description</htmlDetail>//
<advrtStmt>9789792771251</advrtStmt>
<sellerPrdCd>815210</sellerPrdCd>
<selTermUseYn>N</selTermUseYn>
<selPrc>$product_price</selPrc>
<prdSelQty>9999</prdSelQty>
<cuponcheck>Y</cuponcheck>
<dscAmtPercnt>25</dscAmtPercnt>
<cupnDscMthdCd>01</cupnDscMthdCd>
<cupnIssStartDy>13/08/2014</cupnIssStartDy>
<cupnIssEndDy>20/08/2014</cupnIssEndDy>
<cupnUseLmtDyYn>Y</cupnUseLmtDyYn>
<pointYN>Y</pointYN>
<pointValue>100</pointValue>
<spplWyCd>02</spplWyCd>
错误显示在下面:
Error 400--Bad Request
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.4.1 400 Bad Request
The request could not be understood by the server due to malformed syntax.
The client SHOULD NOT repeat the request without modifications.
我把“ //”符号的意思是这个“产品描述”代码不能正常工作。如果可以的话,它将显示如下示例图片:enter image description here 希望有人可以帮助我解决此问题,并让我知道哪些部分出现错误。谢谢。