Es gibt zwei Ausnahmen von der require
Block fehlt:
require_once 'src/Exception.php';
require_once 'src/Exception/SignerException.php';
diese Hinzufügen sollte das Problem beheben.
Der vollständige Codeblock spülen Sie verwenden würden:
$auth = \Akamai\Open\EdgeGrid\Authentication::createFromEdgeRcFile('ccuv3', './.edgerc');
$auth->setHttpMethod('POST');
$auth->setPath('/ccu/v3/invalidate/url');
$body = json_encode(array(
'hostname' => 'example.org',
'objects' => array('/path/to/object', '/path/to/other/object')
));
$auth->setBody($body);
$context = array(
'http' => array(
'header' => array(
'Authorization: ' . $auth->createAuthHeader(),
'Content-Type: application/json',
'Content-Length: ' . strlen($body),
),
'method' => 'POST',
'content' => $body
)
);
$context = stream_context_create($context);
$response = json_decode(file_get_contents('https://' . $auth->getHost() . $auth->getPath(), null, $context));
Noch besser wäre es, dies in einer Funktion einpacken wäre:
function fastPurge($hostname, array $objects)
{
$body = json_encode(array(
'hostname' => $hostname,
'objects' => $objects
));
$auth = \Akamai\Open\EdgeGrid\Authentication::createFromEdgeRcFile('ccuv3', './.edgerc');
$auth->setHttpMethod('POST');
$auth->setPath('/ccu/v3/invalidate/url');
$auth->setBody($body);
$context = array(
'http' => array(
'header' => array(
'Authorization: ' . $auth->createAuthHeader(),
'Content-Type: application/json',
'Content-Length: ' . strlen($body),
),
'method' => 'POST',
'content' => $body
)
);
$context = stream_context_create($context);
$response = json_decode(file_get_contents('https://' . $auth->getHost() . $auth->getPath(), null, $context));
}
// Call the fastPurge function
fastPurge('example.org', array('/path/to/object', '/path/to/other/object'));
Welche Fehler? Bitte zeigen Sie Ihren Code. – Barmar
Die Fehlerzeilen sind als '//' markiert 'require_once 'src/Authentication.php'; require_once 'src/Authentifizierung/Zeitstempel.php'; require_once 'src/Authentifizierung/Nonce.php'; require_once 'src/Exception/ConfigException.php'; // Schwerwiegender Fehler: Klasse 'Akamai \ Open \ EdgeGrid \ Exception' nicht in \ src \ Exception \ ConfigException.php in Zeile 22 gefunden require_once 'src/Exception/SignerException/InvalidSignDataException.php'; // Schwerwiegender Fehler: Klasse 'Akamai \ Öffnen \ EdgeGrid \ Exception \ SignerException' in \ src \ Exception \ SignerException \ InvalidSignDataException.php in Zeile 22 nicht gefunden – modellita
Setzen Sie die Details in die Frage. – Barmar