Basic HTTP Authentication (how to login as client using php) -


i need basic http authentication. can login using php client side? kind of tags put following code?

get /rest/v1/locales/ http/1.1 host: api.2dehands.com authorization: basic ehl6ojeymw== 

you need send http request url , in php have curl that, have mentioned basic authentication.

also note curlopt_userpwd sends base64 of user:password string http header below:

authorization: basic ehl6ojeymw== 

here example of same,

$url = 'http://api.2dehands.com/rest/v1/locales/';  $ch = curl_init($url);     curl_setopt($ch, curlopt_userpwd, $username . ":" . $password);     curl_setopt($ch, curlopt_timeout, 30);     curl_setopt($ch, curlopt_returntransfer, true);     // add more options if wish $response = curl_exec($ch);     curl_close($ch); 

$response contain response $url


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -