SDK Method | PHP
Learn to implement ScraperAPI's PHP SDK for efficient web scraping. Includes setup for Requests and Scrapy, with advanced features like JS rendering.
To make it easier to get up and running you can also use our SDK. First, you will need to install the SDK:
composer require scraperapi/sdk
Then integrate it into your code:
# remember to install the library: composer require scraperapi/sdk
<?php
$client =
new
ScraperAPI\Client("APIKEY"); $result = $client->get("http://httpbin.org/ip")->raw_body;
print($result);
To enable extra functionality while using our SDK, simply add an additional parameter to the GET request:
# remember to install the library: composer require scraperapi/sdk
<?php
$client =
new
ScraperAPI\Client("APIKEY"); $result = $client->get("http://httpbin.org/ip", ["render"
=>
true])->raw_body;
print($result);
To use two or more parameters, simply add them to the GET request:
# remember to install the library: composer require scraperapi/sdk
<?php
$client =
new
ScraperAPI\Client("APIKEY"); $result = $client->get("http://httpbin.org/ip", ["render"
=>
true], [“country_code” => “us”])->raw_body;
print($result);
Last updated
Was this helpful?