$apiUsername = "_YOUR_API_USERNAME_";
$secretKey = "_YOUR_SECRET_KEY_";
'name' => 'Samsung galaxy S2',
'image' => 'http://example.com/images/samsung-galaxy-s-2.jpg',
'shippingWeight' => 370, // gram
'importPrice' => 12000000,
$dataString = json_encode($dataArray);
$checksum = md5(md5($secretKey . $dataString) . $dataString);
"apiUsername" => $apiUsername,
$curl = curl_init(“https://dev.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) {