Http request with login and password

Hi all,

I have an arduino nano wired to an ethernet controller (ENC28J60) i got from ebay in SPI. I saw that i need to use UIPethernet library with this kind of controller.

My problem is that, I want to move a Dlink camera (5020L) with it.

I can control it from my PC in my navigator with an http request. When i send the request, a pop up open for me to enter the login and password.

The request look like that :
192.168.0.103/pantiltcontrol.cgi?PanSingleMoveDegree=2&TiltSingleMoveDegree=5&PanTiltSingleMove=5

No problem till then.

When i do it on my arduino i need to send the request with the login and password in it.
I try several different request from my navigator and arduino and i cant do that. There is ether an error ether i need to login in the pop up (in navigator).

for exemple i try :
admin:@192.168.0.103/ ...
192.168.0.103/login=admin&password=
& ...
...

if (client.connect(server, 80)) {
   Serial.println("connected");
   client.println("GET /pantiltcontrol.cgi?PanSingleMoveDegree=2&TiltSingleMoveDegree=5&PanTiltSingleMove=5 HTTP/1.1");
   client.println("Host: admin:****@192.168.0.103");
   client.println("Connection: close");
   client.println();
}

(All the things are in the same network)

In my research I saw that Chrome can use request with login and password in it because this navigator can handle this. But not my program / library.

Do you know how to build the request or maybe use another library i dont know ?
Thank you!

This is my first post and I dont speak fluent english, so I'm sorry if I forgot something or say something strange.

Given your camera uses HTTP basic authentication, change the line

   client.println("Host: admin:****@192.168.0.103");

to

   client.println("Host: 192.168.0.103");

and add this to your subroutine:

   client.println("Authorization: Basic YWRtaW46YXJkdWlubwo=");

The characters after “Basic” in that line are the base64 encoded username and password in the format “username:password”. The above string is correct if your username is “admin” and your password is “arduino”.

Thank you for your answer, I try it with my login but the access is still unauthorised.

Apparently we can do it in python with urllib2. Is there any alternative of this library in arduino ?

Apparently we can do it in python with urllib2. Is there any alternative of this library in arduino ?

No, but it may help if you post the code you use there as then we know at least how your device reacts and what request it expects.