Open website

Hi, I'm new to arduino and have an ethernet shield and an uno.

I was just wondering if someone could provide some sample code of connecting to a website?

I don't need to pass any data or anything, I simply need to poll it once.

Thanks,

Max

Are you trying to send a POST or GET request?

Hi, I'm new to arduino and have an ethernet shield and an uno.

That and a network cable are all you need to connect to the web.

I was just wondering if someone could provide some sample code of connecting to a website?

The Arduino IDE comes with examples. Why are they not sufficient?

I was just wondering if someone could provide some sample code of connecting to a website?

The Arduino IDE comes with examples. Why are they not sufficient?
[/quote]

Because all the examples connect to a server IP whereas I only want to load a website, I have a php page with code that I want run, and all that needs doing is for any client to open the page. No GET or POST required.

Thanks

Because all the examples connect to a server IP

Not true. There are client examples that get data from a server, and there are server examples that make the Arduino a server.

whereas I only want to load a website

You want the Arduino to serve up the web page (not site)?

I have a php page with code that I want run

By what? The Arduino as web server will not be able to serve up php pages.

and all that needs doing is for any client to open the page. No GET or POST required.

The client needs to make a GET request!

I just need the arduino to poll the website. There is no data returned, I just need the php to run. I do not need the arduino to read it or anything, I just want the thing to run!

I just need the arduino to poll the website.

What web site? What is the Arduino supposed to GET from the web site?

There is no data returned

Not a very useful site, then.

I just need the php to run.

Well, OK. You still need to make a GET request to make that happen.

I do not need the arduino to read it or anything, I just want the thing to run!

Yes, you do need the Arduino to read the reply. Every server returns some data, even if the called script doesn't add any data of its own. If you fail to read that data, the socket will not be closed. With only 4 sockets, you will quickly exhaust all allowable connections.

So, why is the client example not sufficient? How is what you want the Arduino to do any different from using Internet Explorer or Firefox as the client?

It's not. That's exactly what I want. I want the arduino to act like a browser. That is all.

I want the arduino to act like a browser.

There are servers and there are clients. A browser is a client capable of displaying the fetched data in a useful format. The Arduino, running the client example, can get the data, although it can't do much in the way of rendering the html/xml/php/jpg data that it gets.

It can, however, parse the data that it receives, and do things like turn pins on or off.

So, the client example will fit your needs? Or, do you need help modifying it? Have you even tried loading it, to see what happens?

Basically, I have a URL but no IP because it's a free hosting service.

All I want is for the arduino to open the website when I press a button - by open I mean only go to the link so the PHP is run, like a cron job I think...

Sorry for any confusion

Basically, I have a URL but no IP because it's a free hosting service.

With Arduino 1.0, DNS is supported, so you can use names, not just IP addresses. You will need to use the Host: line to identify your particular site on the domain.

All I want is for the arduino to open the website when I press a button - by open I mean only go to the link so the PHP is run, like a cron job I think...

The Arduino as client performs a GET. That causes the specified script to be executed, and whatever data the script adds to the output stream is returned. As is any data generated by the server itself. If the script doesn't write anything to the output stream, there is still server data that needs to be read.