File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -10,9 +10,10 @@ composer require raph6/httprequest
1010``` php
1111$http = new HttpRequest();
1212$http->setUrl('http://localhost:8080')
13- ->setData(['foo' => 'bar'])
14- ->setHeaders(['token' => '123456'])
15- ->setUserAgent('PHP/Curl (https://github.com/raph6/httprequest)');
13+ ->setData(['foo' => 'bar'])
14+ ->setHeaders(['token' => '123456'])
15+ ->setUserAgent('PHP/Curl (https://github.com/raph6/httprequest)')
16+ ->setBasicAuth('username', 'password');
1617
1718var_dump($http->post());
1819// var_dump($http->get());
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ public function __construct () {
2424
2525 public function setBasicAuth ($ username , $ password ) {
2626 curl_setopt ($ this ->_ch , CURLOPT_USERPWD , $ username . ": " . $ password );
27+ return $ this ;
2728 }
2829
2930 public function setHeaders ($ headers = array ())
You can’t perform that action at this time.
0 commit comments