scrapemax / scrapemax-php
There is no license information available for the latest version (0.0.6) of this package.
Scrapemax PHP API Client
0.0.6
2023-12-09 20:23 UTC
Requires
Requires (Dev)
- phpunit/phpunit: ^10.5
This package is not auto-updated.
Last update: 2024-09-15 00:23:34 UTC
README
A PHP client for the Scrapemax API.
Installation
composer require scrapemax/scrapemax-php
Usage
require_once 'vendor/autoload.php'; use Scrapemax\ScrapemaxClient; // Instantiate the ScrapeClient with the API base URL and key $client = new ScrapemaxClient('https://api.scrapemax.com', 'your_api_key'); // Use the ScrapeClient to make API requests $response = $client->scrape([ 'js_enabled' => 1, 'target_url' => 'https://example.com/page', 'proxy' => 'premium', 'type' => 'data' ]); print_r($response);
Custom Guzzle Client
If you have specific requirements for your Guzzle client, you can use your own instance by passing it as the third parameter to the ScrapeClient
constructor. Ensure that the custom client includes the 'base_uri' option to specify the API endpoint. Here's an example:
use GuzzleHttp\Client as GuzzleClient; use Scrapemax\ScrapemaxClient; // Instantiate a custom Guzzle client with additional configuration $customGuzzleClient = new GuzzleClient([ 'base_uri' => 'https://api.scrapemax.com', 'timeout' => 5, // Add any other Guzzle client options as needed ]); // Instantiate the ScrapeClient with the API base URL, key, and custom Guzzle client $client = new ScrapemaxClient('https://api.scrapemax.com', 'your_api_key', $customGuzzleClient); // Use the ScrapeClient to make API requests with the custom Guzzle client $response = $client->scrape([ 'js_enabled' => 1, 'target_url' => 'https://example.com/page', 'proxy' => 'premium', 'type' => 'data' ]); print_r($response);