Basic Authentication

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
GeXus
Forum Regular
Posts: 631
Joined: Sat Mar 11, 2006 8:59 am

Basic Authentication

Post by GeXus »

I'm trying to access an API that has basic authentication, how would I go about authenticating myself in php? Obviously, i have the necessary credientials
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

How do you expect us to answer your question without knowing what api you're talking about?

Read their docs?
GeXus
Forum Regular
Posts: 631
Joined: Sat Mar 11, 2006 8:59 am

Post by GeXus »

It's basic authentication, i'm pretty sure it's universal. http://en.wikipedia.org/wiki/Basic_auth ... ion_scheme
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

I still suggest you read the api's documentation, as assuming things will get you in trouble.


Basic HTTP Authentication: http://ca.php.net/features.http-auth
User avatar
stereofrog
Forum Contributor
Posts: 386
Joined: Mon Dec 04, 2006 6:10 am

Post by stereofrog »

@GeXus, from what I understand you are trying to access another site/webservice and need to authorize yourself with http auth. If this is true, I suggest you use CURL, read about CURLOPT_HTTPAUTH and CURLOPT_USERPWD on the curl_setopt() page.
Post Reply