Skip to main content
The PHP SDK requires PHP 8.1 or later and Composer. SDKs covers the API key and the defaults all SDKs share.

Install

Guzzle is the HTTP transport. If your project already has a PSR-18 client and PSR-17 factories, you can use those instead.

Scrape a page

Save this as scrape.php beside your vendor directory and run php scrape.php. It prints the page as Markdown, starting with # Example Domain.
scrape.php
Methods take named arguments. Nested values are associative arrays keyed by the API’s camelCase field names.

Look up a brand

The generated Brand helper requires the fields of every lookup type at once, so it can’t send a single lookup such as by_domain. Use the SDK’s low-level request method instead. It keeps the SDK’s authentication, retries, and error handling, and every PHP Brand example in these docs uses it. Save this as brand.php and run php brand.php. It prints the company name.
brand.php
Keep the path relative (brand/retrieve, with no leading slash) so the request keeps the /v1 base path. The method returns the raw HTTP response, so decode the body yourself.

Notes

  • Set timeout in seconds and maxRetries on the client: new Client(requestOptions: ['timeout' => 120, 'maxRetries' => 0]).
  • If $client->web->scrape doesn’t accept an option you need, such as highlightsParams, jsonParams, or productParams, your installed version predates it. Send the request with $client->request(method: 'post', path: 'web/scrape', body: [...]).