YII2 CURL
YII2 CURL using Library codeigniter by - http://philsturgeon.co.uk/code/codeigniter-curl - https://github.com/philsturgeon/codeigniter-curl/blob/master/libraries/Curl.php, (*1)
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist udamuri/yii2-curl "*"
or add, (*4)
"udamuri/yii2-curl": "*"
to the require section of your composer.json
file., (*5)
Once the extension is installed, simply use it in your code by :, (*6)
```php //GET $tes = \udamuri\curl\YiiCurl::widget([ 'setMethod' => 'get', 'setAuth' => ['user', 'password'], 'setUrl'=>'http://website.com/api/100' ]);, (*7)
//POST $body = [ [ "name" => "Tes", "email" => "tes@gmail.com", "blog" => "tes.xx.com", "company" => "Gite", "bio" => "Lorem Ipsum Dolor SIt Amet" ], [ "name" => "Tos", "email" => "tos@gmail.com", "blog" => "tos.xx.com", "company" => "Gite", "bio" => "Lorem Ipsum Dolor SIt Amet" ] ];, (*8)
$tes = \udamuri\curl\YiiCurl::widget([ 'setMethod' => 'post', 'setAuth' => ['user', 'password'], 'setBody' => $body, 'setUrl'=>'http://ladoapi.dev/example/create' ]);```, (*9)