Pages: [1]   Go Down
Author Topic: Make an arduino log-in to a password protected website  (Read 686 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I have an arduino uno equipped with an ethernet shield.
I want to connect an arduino to a Siemens PLC S7-1200 using the internet.
The PLC acts as a webserver which displays a webpage where a user can view/change outputs of the PLC.
Instead of a person, I want the arduino to control the outputs of the PLC using the build-in webserver of the Siemens PLC.

The problem is that the webpage is password protected (this can't be changed) and I don't know how to log-in using an arduino.
The website is plain HTML (see the attachment).
Also I have no clue how to tell the arduino to "press a button" (change an output from 0->1)on the website of the PLC.

Is this possible ? And could somebody give me some example code how to do this?

Thank in advance,
Koen

* index.html (1.97 KB - downloaded 28 times.)
Logged

Earth
Offline Offline
Edison Member
*
Karma: 41
Posts: 1387
My browser no longer is binding static IP, Floating is the way to go.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It seem PLC S7-1200 use form authentication, which require preserve cookie between login url and protection url. The arduino by alone is hard to preserve cookie if not impossible.

One work around;-

Add proxy code which run at PC/web server, which does preserve cookie between login url and protection url.

arduino ---> proxy server ---> PLC S7-1200


if u still need some type of authentication, then u have 2 plans

plan A.
IP authentication

plan B
Basic authentication

add one of them into proxy code.


Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok thanks for the help! I'm going to try this this week  smiley-cool
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It seem PLC S7-1200 use form authentication, which require preserve cookie between login url and protection url. The arduino by alone is hard to preserve cookie if not impossible.

The cookie is sent in the HTTP header, for example:

Code:
HTTP/1.1 200 OK
Date: Fri, 28 Apr 2006 03:14:58 GMT
Server: Apache/2.0.46 (Unix) PHP/4.3.2
Set-Cookie: foo=bar
Set-Cookie: food=apples
Connection: close
Content-Type: text/html; charset=iso-8859-1

That sets two cookies (foo and food).

When you receive the HTTP header you could save those.

Then when you reply you also have a Set-Cookie line and return the cookie value.
Logged

Pages: [1]   Go Up
Jump to: