User tests: Successful: Unsuccessful:
At the moments it's not possible to connect to urls, which has a htaccess password protection. With this patch, you can provide login credentials
$options = new \Joomla\Registry\Registry();
$http = JHttpFactory::getHttp($options);
$url = 'http://your-url.tld';
$result = $http->get($url);
print_r($result);
$credentials = array('userauth' => 'htaccessuser', 'passwordauth' => 'htaccesspassword');
$options = new \Joomla\Registry\Registry($credentials);
$http = JHttpFactory::getHttp($options);
$url = 'http://your-url.tld';
$result = $http->get($url);
print_r($result);
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Category | ⇒ | Libraries |
beside basic HTTP Auth, can this also be available also for other HTTP Auth methods?
Hello,
it should be possible, but the other transport has to support it, too (I guess). First I had a parameter for such a case, but I wasn't sure about stream/socket, so I removed it for this PR (perhaps add it later)
ok. for another PR then.
I will test this when i have time.
If the transport doesn't support it, it doesn't support it. Sockets don't support (AFAIK) specifying a certificate file to verify SSL against, the others do and we have options for that.
OK, for the next PR :)
I have tested this item successfully on ddab83c
Tested with success with the 3 possible transport methods.
$options = new \Joomla\Registry\Registry(array('userauth' => 'user', 'passwordauth' => 'password'));
$url = 'http://domain.tld/auth/a.txt'; // this file contents is "abc". The "auth" dir is protected by HTTP Basic Auth
print_r(JHttpFactory::getHttp($options, 'curl')->get($url));
print_r(JHttpFactory::getHttp($options, 'socket')->get($url));
print_r(JHttpFactory::getHttp($options, 'stream')->get($url));
Results:
JHttpResponse Object
(
[code] => 200
[headers] => [...]
[body] => abc
)
JHttpResponse Object
(
[code] => 200
[headers] => [...]
[body] => abc
)
JHttpResponse Object
(
[code] => 200
[headers] => [...]
[body] => abc
)
I have tested this item successfully on ddab83c
I have testet this successfully, following the testing instructions.
Status | Pending | ⇒ | Ready to Commit |
Labels |
Added:
?
|
Milestone |
Added: |
||
Labels |
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-05-02 06:38:06 |
Closed_By | ⇒ | rdeutz | |
Labels |
Labels |
Removed:
?
|
Labels |
Added:
?
|
@andrepereiradasilva you're right. Thanks