Pass user and pw to web server via php

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
myitanalyst
Forum Newbie
Posts: 24
Joined: Wed Dec 14, 2005 4:31 pm

Pass user and pw to web server via php

Post by myitanalyst »

I am posting to a web service that require user authentication. I simply clear security in the normal dialog box and all is well.

However I need to do this via a php script. I have everything ready to go other than trying to pass user and security to the site when posting.

How can I do this. The user is an actual email address and the a password.

I have tried the formation http://user@pw:www.postpage.com/post/ but since the user is an email address with the @ sign it seems to crap out. I haven't done this before so any help would be greatful.

Thanks
myitanalyst
Forum Newbie
Posts: 24
Joined: Wed Dec 14, 2005 4:31 pm

Post by myitanalyst »

Found it... had to use the following:

Code: Select all

$headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n";
Post Reply