Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $product_data = array(
- array(
- 'id' => $subproduct_id,
- 'status' => 0,
- )
- );
- $marketplace = 'https://marketplace.emag.bg';
- $password = 'xxx';
- $user = 'anglingproshop';
- //$code = 'anglingproshop'; //OLD
- // $hash = sha1(http_build_query($product_data) . sha1($password)); //OLD
- $hash = base64_encode($user . ':' . $password);
- $headers = array('Authorization: Basic ' . $hash);
- $requestData = array(
- //'code' => $code, //OLD
- //'username' => $user, //OLD
- 'data' => $product_data,
- //'hash' => $hash //OLD
- );
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $marketplace.'/api-3/product_offer/read');
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
- curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($requestData));
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- $result = curl_exec($ch);
- curl_close($ch);
- $result = json_decode($result);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement