rem42 / scraper-tinypng
TinyPNG uploader via scraper
v1.0
2018-08-28 10:43 UTC
Requires
- php: >=5.5.9
- doctrine/common: ^2.8
- jms/serializer-bundle: ^2.0
- rem42/scraper: ^1.0
- symfony/dom-crawler: ^3.0
This package is auto-updated.
Last update: 2024-12-07 20:38:40 UTC
README
This scraper TinyPNG use Scraper.
Installation
$ composer require rem42/scraper-tinypng "^1.0"
Configuration
Nothing Needed
Usage
<?php 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);
In the result var there is the Upload entity wich contains all the result from tinypng json response serialized in this entity.
You can also use a web upload and you only need tu set an url :
<?php 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);