Hello Guys! I am trying to access a wordpress website and find a particular string on the website. However, I can't connect to any website, other than google.com. Any help on finding the string and on accessing website would be apperciated.
#include <SPI.h>
#include <Ethernet.h>
/* configure address and server */
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
/* website to access */
char server[] = "www.google.com";
/* to set static IP address: example*/
//IPAddress ip(192,168,0,177);
boolean powerOns = false;
const int powerPin = A0; // pin on arduino
const int ledPin = 13; // indication
int result; // the number
//char strData[32];
//int stringPos = 0;
boolean startRead = false;
// initialize Ethernet client library
EthernetClient client;
// set up environment
void setup()
{
Serial.begin(9600); // serial data transmission rate
delay(1000);
if(Ethernet.begin(mac) == 0)
{
Serial.println("Failed to connect");
}
// if connected; port 80 is default for HTTP
if(client.connect(server,80))
{
Serial.println("connected");
}
}
// run repeatedly
void loop()
{
if(client.connected() )
{
Serial.println("d");
//Serial.println("availible");
char c = client.read();
if(c == 'g')
{
Serial.println("z");
}
client.stop();
client.flush();
}
if(!client.connected())
{
client.stop();
}
} // end of loop
// if connected; port 80 is default for HTTP
if(client.connect(server,80))
{
Serial.println("connected");
}
}
// run repeatedly
void loop()
{
if(client.connected() )
{
I access the website by connecting it; did I do it right?
What do you mean? I wanted to know if I am connecting it right.
This is what I have after. I want to read the text on the website and find the letter g
frostkarrotor:
What do you mean? I wanted to know if I am connecting it right.
This is what I have after. I want to read the text on the website and find the letter g
I mean that the library you're using doesn't include the http stack, so you'll actually need to issue the request to get the page. Just connecting over TCP isn't enough.