$appId => "_YOUR_APP_ID";
$accessToken => "_YOUR_ACCESS_TOKEN";
$businessId => "_YOUR_BUSINESS_ID"; // ID doanh nghiệp trên Nhanh.vn
"name" => "Samsung galaxy S2",
"image" => "http://example.com/images/samsung-galaxy-s-2.jpg",
"shippingWeight" => 370, // gram
"importPrice" => 12000000,
$dataString = json_encode($dataArray);
"businessId" => $businessId,
"accessToken" => $accessToken,
$curl = curl_init("https://open.nhanh.vn/api/product/add");
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postArray);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$curlResult = curl_exec($curl);
if(! curl_error($curl)) {
$response = json_decode($curlResult);
// failed, cannot connect nhanh.vn
$response = new stdClass();
$response->messages = array(curl_error($curl));
if ($response->code == 1) {
// send product successfully
// failed, show error messages
if(isset($response->messages) && is_array($response->messages)) {
foreach($response->messages as $message) {