PHP code example of sapistudio / http

1. Go to this page and download the library: Download sapistudio/http library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sapistudio / http example snippets


use SapiStudio\Http\Browser\HeadlessChrome;

HeadlessChrome::url('https://example.com')->save($pathToImage);

use SapiStudio\Http\Browser\StreamClient;

$streamClient  = StreamClient::make();
$guzzleClient  = StreamClient::makeGuzzle();

use SapiStudio\Http\Browser\StreamClient;
use \SapiStudio\Http\Html;

$linksValidation = Html::testUris($content);
// content can be html string,or an array containing links to be tested
//or only an array of links
$linksValidation = StreamClient::make()->validateLinks($links);

use SapiStudio\Http\Browser\StreamClient;

$uris[$uniqueIndex] = [
  StreamClient::ASYNC_URIPATH_MAP     => 'path to download', 
  StreamClient::ASYNC_URILINK_MAP     => 'url link'
];
$uris = StreamClient::make()->downloadFilesAsync($uris);

use SapiStudio\Http\DeviceDetector;

DeviceDetector::uAgent($b['uagent'])