PHP code example of raaabdullah1 / meta-graph-errors

1. Go to this page and download the library: Download raaabdullah1/meta-graph-errors library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

raaabdullah1 / meta-graph-errors example snippets


use MetaGraphErrors\MetaErrorClassifier;

$error = MetaErrorClassifier::fromResponse($response->json());

if ($error->  // rate limits and transient failures: retry after a delay
} else {
    echo $error->hint; // plain-language explanation
}

use Illuminate\Http\Client\RequestException;
use Illuminate\Support\Facades\Http;
use MetaGraphErrors\MetaErrorClassifier;

try {
    Http::withToken($pageToken)
        ->post("https://graph.facebook.com/v21.0/{$pageId}/feed", ['message' => $text])
        ->throw();
} catch (RequestException $e) {
    $error = MetaErrorClassifier::fromResponse($e->response->json() ?? []);

    if ($error->

// From a decoded response, a JSON string, or just the numbers
MetaErrorClassifier::fromResponse($decodedArray);
MetaErrorClassifier::fromResponse($jsonString);
MetaErrorClassifier::classify(code: 190, subcode: 463);