I'm starting an integration with B2W, they use a REST / JSON API, I am not finding where it is wrong in my code, it is something relative to the header, as I test with the chrome dhc complement and register the change correctly:
Mycode:
$url='https://api-sandbox.bonmarketplace.com.br/sku/10205_SKU1/price';$data=json_encode(array("sellPrice"=> "400.00",
"listPrice"=> "400.00"
)
);
//echo "<br>".$usuario = base64_encode("$username:");
//Content-Type:application/json;charset=utf-8;
$options = array(
"http" => array(
"method" => "PUT",
"header" => "Content-Type: [application/json; charset=UTF-8; Authorization: Basic NjU5NjdGQkZBMDEzNjUwMTkyNzc1OTQ5MDI2NjUzNEU6",
"content" => $data
));
print_r($options);
$context = stream_context_create($options);
print_r($context);
// make the request
$response = file_get_contents($url, false, $context);
Unauthorized 401 error