Example:
curl H "Contenttype: application/xml" \
H "AcceptCharset: utf8" \
H "openapikey:50667854bb253d281ce0fe36ebaeebaa" \
api.11street.com.my
How to I authenticate in PHP using curl by using the information above?
After that I want to add product by using curl. Below is my code and it is not working. Website URL: http://lazino.com.my/super/marketplace/11street.php
<?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;
?>