webscrapingapi / php-sdk
There is no license information available for the latest version (v1.0) of this package.
SDK for sending http requests written in php
v1.0
2022-09-13 07:20 UTC
Requires
- symfony/http-client: ^6.1
This package is not auto-updated.
Last update: 2024-12-18 16:11:15 UTC
README
WebScrapingApi is an API that allows scraping websites while using rotating proxies to prevent bans. This SDK for PHP makes the usage of the API easier to implement in any project you have.
Installation
Run the following command in the main folder of your project:
composer require webscrapingapi/php-sdk
API Key
To use the API and the SDK you will need a API Key. You can get one by registering at WebScrapingAPI.
Usage
Using the SDK it's quite easy. An example of a GET call to the API is the following:
<?php
namespace Examples {
require('main.php');
use WebScrapingApi\Client;
$API_KEY = "YOUR_API_KEY_HERE"; // enter your api key here
$client = new Client($API_KEY);
$params = array(
# API Parameters
# Set to 0 (off, default) or 1 (on) depending on whether or not to render JavaScript on the target web page. JavaScript rendering is done by using a browser.
"render_js" => 1,
# Set datacenter (default) or residential depending on whether proxy type you want to use for your scraping request. Please note that a single residential proxy API request is counted as 25 API requests.
"proxy_type" => "datacenter",
# Using the auto_parser parameter, you can get the scraped site in JSON format.
"auto_parser" => 1
);
print($client->get('https://bing.com', $params));
}
For more reference, you can check out multiple examples here here
For a better understanding of the parameters, please check out our documentation