How to access a WebServer with login by a WebClient

Hi,
I want to access a WebServer (Camera IP) with login by a Arduino-WebClient, but I dont know how do it.
I have tried this code on Arduino-WebServer:

if (client.connect(server, 81)) {
** Serial.println("connected");**
** // Make a HTTP request:**
** //client.println("GET /search?q=arduino HTTP/1.1");**
** client.println("GET /myusername:mypassword HTTP/1.1");**
** //client.println("Host: www.google.com");**
** client.println("Host: IPCamera_Web");**
** client.println("Connection: close");**
** client.println();**
** }**
** else {**
** // kf you didn't get a connection to the server:**
** Serial.println("connection failed");**
** }**

My WebCamIP response this:

HTTP/1.1 401 Unauthorized
Server: IPCamera-Web
Date: Fri Jul 26 23:50:13 2013
WWW-Authenticate: Basic realm="IPCamera_Web"
Pragma: no-cache
Cache-Control: no-cache
Content-Type: text/html
Document Error: Unauthorized
**

Access Error: Unauthorized

**
**

Access to this document requires a User ID

**

How I can get authorization of my WebCamIP, with Arduino, please!
Thank you in advance!
Best regards,

AJoao

From Basic access authentication - Wikipedia

When the user agent wants to send the server authentication credentials it may use the Authorization header.

The Authorization header is constructed as follows:

Username and password are combined into a string "username:password"
The resulting string literal is then encoded using Base64
The authorization method and a space i.e. "Basic " is then put before the encoded string.

For example, if the user agent uses 'Aladdin' as the username and 'open sesame' as the password then the header is formed as follows:

Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

You can learn about Base64 here: Base64 - Wikipedia

Hi johnwasser,
I have tried to program my Arduino-WebClient again, after your post, but I cant access to my WebCam yet.
I have see these links:
Link to converter online: Base64 Online - base64 decode and encode
Basic access authentication - Wikipedia
Authenticating REST Requests
HTTP Authentication | HttpWatch

Part of my Arduino-WebClient code is:
if (client.connect(server, 81)) {
** Serial.println("connected");**
** // Make a HTTP request:**
** //client.println("GET /username:pass HTTP/1.1"); // ???**
** client.println("GET /username/pass HTTP/1.1"); // ???**

** client.println("Host: 192.168.1.244");**
** //client.println("Host: IPCamera_Web");**

** client.println("Authorization: Basic dXNlcm5hbWU6cGFzcw==");**

** client.println("Connection: close");**
** client.println();**
** }**
** else {**
** // kf you didn't get a connection to the server:**
** Serial.println("connection failed");**
** }**

The WebCam response:
HTTP/1.1 403 Forbidden
Server: IPCamera-Web
Date: Sat Jul 27 12:53:53 2013
Pragma: no-cache
Cache-Control: no-cache
Content-Type: text/html
Document Error: Forbidden
**

Access Error: Forbidden

**
**

Access Denied**
Prohibited User

I dont know here is my bug!!!
Somebody can help me, please!
Thank you in advance!
Best regards,

Ajoao

AJoao

What exact URL do you use to connect to your webcam with a browser? Does it work from the browser if you put 'username:pass@' in front of the address?

You may need to search Google for the make of your web cam to see if there is detailed info on its operation or a user's manual. Make sure you are doing the base64 encoding properly like below (the bottom links have encode and decode for checking). I use something similar to update my no-ip account.

myusername:mypassword

bXl1c2VybmFtZTpteXBhc3N3b3Jk

http://www.opinionatedgeek.com/dotnet/tools/base64encode/

http://www.opinionatedgeek.com/DotNet/Tools/Base64Decode/default.aspx

Hi,
thank you everybody by to dispend your time with me!
Hi already did find a solution for my project. It is the following:
On Chrome:
http://username:pass@192.168.1.244:81/video/livesp.asp. It is Ok!
On Firefox it is necessary to confirm the login.
On IE dont work!

On Arduino-WebClient:
Serial.println("connected");
** // Make a HTTP request:**
** client.print("GET /Authorization: Basic ");**
** client.print("dXNlcm5hbWU6cGFzcw==@192.168.1.244:81");**
** client.println("/video/livesp.asp HTTP/1.1");**
** client.println("Host: IPCamera_Web");**
** client.println("Connection: close");**
** client.println();**
** }**
** else {**
** // kf you didn't get a connection to the server:**
** Serial.println("connection failed");**
** }**

It is OK!
See this link: HTTP Authentication | HttpWatch
And this link to converter Base64 online: Base64 Online - base64 decode and encode
See this link too: Basic access authentication - Wikipedia

But my project dont is complete yet! But already it is a begin...
I will go to thinging about that...
Best regards,

AJoao

Hallo,
even old topic... I solve similar problem.
Solution with: http://username:pass@10.20.0.6/monitor2.htm works on browser so good.
But I want to access ip camera PTZ by calling: http://10.20.0.6/decoder_control.cgi?command=35
from arduino. Last number in link (35) will be variable and will change according to specific wiev of camera that I want to set.
Any help, please?