PHP code example of sevavietl / artax-dumper
1. Go to this page and download the library: Download sevavietl/artax-dumper 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/ */
sevavietl / artax-dumper example snippets
\Amp\Loop::run(static function () {
$curlRequestDumper = new \ArtaxDumper\Request\CurlRequestDumper();
// GET Request
$request = new \Amp\Artax\Request('https://httpbin.org/get');
$curl = yield $curlRequestDumper->dump($request); // => curl "https://httpbin.org/get"
// POST Request
$request = (new \Amp\Artax\Request($uri = 'https://httpbin.org/post', 'POST'))
->withBody($body = 'foo=bar');
$curl = yield $curlRequestDumper->dump($request); // => curl -d "foo=bar" "https://httpbin.org/post"
});