Sample code for 30+ languages & platforms
PHP

Shopware Digest Authentication

See more Shopware Examples

Demonstrates using Digest access authentication for Shopware.

Chilkat PHP Downloads

PHP
<?php

use Chilkat2\Http;
use Chilkat2\JsonObject;
use Chilkat2\StringBuilder;

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

$http = new Http();

// To use HTTP Digest Authentication, set the login and password, and also indicate that DigestAuth should be used.
$http->Login = 'api_username';
$http->Password = 'api_key';
$http->DigestAuth = true;

$sbResponseBody = new StringBuilder();
try {
    $http->QuickGetSb('https://my-shopware-shop.com/api/articles?limit=2', $sbResponseBody);
} catch (\Chilkat2\Exception $e) {
    echo $e->getMessage(), "\n";
    exit;
}

$jResp = new JsonObject();
$jResp->LoadSb($sbResponseBody);
$jResp->EmitCompact = false;

echo "Response Body:\n";
echo $jResp->Emit(), "\n";