PHP code example of rem42 / scraper-tinypng

1. Go to this page and download the library: Download rem42/scraper-tinypng 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/ */

    

rem42 / scraper-tinypng example snippets




    use Scraper\Scraper\Client;
    use Scraper\ScraperTinyPNG\Request\TinyPNGUploaderRequest;
    
    $request = new TinyPNGUploaderRequest();
    $request
    	->setFileContent(file_get_contents('path to your file'))
    	->setUserAgent('Need a browser user agent to work !')
    ;
    
    $client = new Client();
    $result = $client->api($request);



    use Scraper\Scraper\Client;
    use Scraper\ScraperTinyPNG\Request\TinyPNGWebUploaderRequest;
    
    $request = new TinyPNGWebUploaderRequest();
    $request
    	->setUrl('url to your file')
    	->setUserAgent('Need a browser user agent to work !')
    ;
    
    $client = new Client();
    $result = $client->api($request);