Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/245.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 11API错误_Php_Curl - Fatal编程技术网

Php 11API错误

Php 11API错误,php,curl,Php,Curl,我试图通过API将产品添加到一个市场(11街)。一切似乎都正常,但它不起作用。有专家能指出这个问题吗?:'( 参考: 我的代码:(URL:) “01”, 'dispCtgrNo'=>“1”, 'prdTypCd'=>“01”, “prdNm”=>“测试产品”, 'prdStatCd'=>“01”, “prdWght”=>“0.1”, “minorSelCnYn”=>“Y”, 'prdImage01'=>“http://staticfs.nexgan.com/images/logo/sallyf

我试图通过API将产品添加到一个市场(11街)。一切似乎都正常,但它不起作用。有专家能指出这个问题吗?:'(

参考:

我的代码:(URL:)

“01”,
'dispCtgrNo'=>“1”,
'prdTypCd'=>“01”,
“prdNm”=>“测试产品”,
'prdStatCd'=>“01”,
“prdWght”=>“0.1”,
“minorSelCnYn”=>“Y”,
'prdImage01'=>“http://staticfs.nexgan.com/images/logo/sallyfashion.com.my_new.jpg",
'selTermUseYn'=>“N”,
'selPrc'=>“25.00”,
“prdSelQty”=>“0”,
'asDetail'=>“测试”,
'dlvMthCd'=>“01”,
'dlvCstInstBasiCd'=>“11”,
'rtngExchDetail'=>“测试”,
'suplDtyfrPrdClfCd'=>“01”
);
curl_setopt($ch,CURLOPT_POST,sizeof($fields_string));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
$html=curl\u exec($ch);
卷曲关闭($ch);
echo$html;
?>

你能比“它不工作”更具体一些吗?他们似乎希望你发送XML,而不是发送一个
多部分/表单数据
(因为你将数组传递给
CURLOPT\u POSTFIELDS
)。您需要构建一个XML字符串并发送它,而不是一个数组。11street肯定是一个可以使用的地狱api
<?php

$ch = curl_init();
//COOKIES
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');
// Headers
$headers = array();
$headers[] = 'Content-Type: application/xml; charset=utf-8';
$headers[] = 'openapikey:50667854bb253d281ce0fe36ebaeebaa';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// URL
curl_setopt($ch, CURLOPT_URL, 'http://api.11street.my/rest/prodservices/product');

$fields_string = array(
'selMthdCd' => "01",
'dispCtgrNo' => "1",
'prdTypCd' => "01",
'prdNm' => "TEST product",
'prdStatCd' => "01",
'prdWght' => "0.1",
'minorSelCnYn' => "Y",
'prdImage01' => "http://staticfs.nexgan.com/images/logo/sallyfashion.com.my_new.jpg",
'selTermUseYn' => "N",
'selPrc' => "25.00",
'prdSelQty' => "0",
'asDetail' => "test",
'dlvMthCd' => "01",
'dlvCstInstBasiCd' => "11",
'rtngExchDetail' => "Test",
'suplDtyfrPrdClfCd' => "01"
);
curl_setopt($ch,CURLOPT_POST, sizeof($fields_string));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);

$html = curl_exec($ch);
curl_close($ch);

echo $html;

?>