Failing to build a simple webclient

I’ve been trying for days now to do a simply web read (I only need to do a simple GET request, which returns ‘true’ or ‘false’ on the website.

The big issue: I’m using an arduino nano (which has VERY limited memory) with an ENC28J60 shield.

I’ve tried many many different scripts and none work. I was succesfull to let the nano act as a server and access it remotely, so it does work. I just can’t get it to work the other way round.

My latest attempt appears to be closest to working…except that it returns nothing. Here’s the script

#include <Nanoshield_Ethernet.h>

static byte mac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
char server[] = "www.google.com";    // name address for Google (using DNS)
EthernetClient client;

void setup() {
 Serial.begin(57600);

 Ethernet.begin(mac);
 delay(1000);

 Serial.println("connecting...");
 if (client.connect(server, 80)) {
   Serial.println("connected");
   // Make a HTTP request:
   client.println("GET /search?q=arduino HTTP/1.1");
   client.println("Host: www.google.com");
   client.println("Connection: close");
   client.println();
 }
 else {
   Serial.println("connection failed");
 }
}

void loop()
{
 if (client.available()) {
   char c = client.read();
   Serial.print(c);
 }

 if (!client.connected()) {
   Serial.println();
   Serial.println("disconnecting.");
   client.stop();

   while (true);
 }
}

The resulting serial output:

connecting...
connected

disconnecting.

any clues on how to proceed?

Are you able to access the web server using your browser ?

use EtherCard library. it has a webclient example

thank you for the replies.

yes I can access the webserver, actually the one in the sketch is google, its just to test.

And 'a few days' means that I've obviously also tested ehterCard with that one I was able to set the nano up as a server but that webclient sketch also failed. The only output to serial I got from that is: [webclient] which basically means that it didnt'even get passed the void setup()