-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
PHP/Endpoint Examples/Multipart Payload/request-status.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
require 'vendor/autoload.php'; // Require the autoload file to load Guzzle HTTP client. | ||
|
||
use GuzzleHttp\Client; // Import the Guzzle HTTP client namespace. | ||
use GuzzleHttp\Psr7\Request; // Import the PSR-7 Request class. | ||
use GuzzleHttp\Psr7\Utils; // Import the PSR-7 Utils class for working with streams. | ||
|
||
$client = new Client(); // Create a new instance of the Guzzle HTTP client. | ||
|
||
$requestId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'; // place the requestId returned from a previous POST request here | ||
|
||
$request_status_endpoint_url = 'https://api.pdfrest.com/request-status/'.$requestId; | ||
|
||
$headers = [ | ||
'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' // Set the API key in the headers for authentication. | ||
]; | ||
|
||
$request = new Request('GET', $request_status_endpoint_url, $headers); // Create a new HTTP GET request with the API endpoint and headers. | ||
|
||
$res = $client->sendAsync($request)->wait(); // Send the asynchronous request and wait for the response. | ||
|
||
echo $res->getBody(); // Output the response body, which contains the status information. | ||
?> |