HELP: ping www."host".com using arduino

can you help me how to ping some servers like www.google.com and count the number of request timed out then reset the device if i got 30 consecutive or accumulated request timed out. then reset the number(request timed out) again. im having problems with my ethernet module enc28j60 it doesnt reconnect itself to the webserver/data logging server which is “iot-ph.com” when the adsl modem is power cycled(turned off and on).

any input from you guys is appreciated im totally new here in arduino and only had a little knowledge with C++ since it looks like java

//Arduino and ENC28j60
//Upload the code into your arduino board using Arduino 1.0.6 or newer version
//for tutorials you may visit http://thinkingparts.blogspot.com/2015/08/home-automation-diy-version-internet.html
#include <EtherCard.h>
#include “DHT.h”
#define DHTPIN 9 // what pin we’re connected to
#define DHTTYPE DHT11 // DHT 22 (AM2302)
DHT dht(DHTPIN, DHTTYPE);
// ethernet interface mac address, must be unique on the LAN
static byte mymac = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
byte Ethernet::buffer[700];
static uint32_t timer;
//change the value of ID
//----------------------
String id = “deviceID”;
//----------------------
String uid = “0”;
String m1;
String ss1, ss2, ss3;
String aa0, aa1, aa2;
String c1, c2, c3;
int s1, s2, s3;
int a1, a2, a3;
int pin1out = 2;
int pin2out = 4;
int pin3out = 6;
int pin1in = 3;
int pin2in = 5;
int pin3in = 7;
String d;
char buf[90];
const char website PROGMEM = “www.iot-ph.com”;
static void my_callback (byte status, word off, word len)
{
Ethernet::buffer[off+300] = 0;
m1 = strstr((const char*) Ethernet::buffer + off, “cmd1”);
}
void setup ()
{
pinMode(pin1out, OUTPUT);
pinMode(pin2out, OUTPUT);
pinMode(pin3out, OUTPUT);
pinMode(pin1in, INPUT);
pinMode(pin2in, INPUT);
pinMode(pin3in, INPUT);
Serial.begin(9600);
dht.begin();
Serial.println("\n[webClient]");
if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
Serial.println( “Failed to access Ethernet controller”);
if (!ether.dhcpSetup())
Serial.println(“DHCP failed”);
//ether.printIp("IP: ", ether.myip);
//ether.printIp("GW: ", ether.gwip);
//ether.printIp("DNS: ", ether.dnsip);
if (!ether.dnsLookup(website))
Serial.println(“DNS failed”);
//ether.printIp(“SRV: “, ether.hisip);
delay(1000);
}
void loop ()
{
ether.packetLoop(ether.packetReceive());
if (millis() > timer)
{
timer = millis() + 4000;
Serial.println();
ether.browseUrl(PSTR(”/account/diy_cmd_sts.php”), buf, website, my_callback);
process();
readdht11();
convert2string();
readytosend();
}
}
void process()
{
c1=m1.substring(5,6);
c2=m1.substring(11,12);
c3=m1.substring(17,18);
s1 = digitalRead(pin1in) + 1;
s2 = digitalRead(pin2in) + 1;
s3 = digitalRead(pin3in) + 1;
if(c1==“2”){
digitalWrite(pin1out,LOW);
}
else if(c1==“1”){
digitalWrite(pin1out,HIGH);
}
if(c2==“2”){
digitalWrite(pin2out,LOW);
}
else if(c2==“1”){
digitalWrite(pin2out,HIGH);
}
if(c3==“2”){
digitalWrite(pin3out,LOW);
}
else if(c3==“1”){
digitalWrite(pin3out,HIGH);
}
}
void readdht11()
{
delay(2000);
a1 = dht.readHumidity();
a2 = dht.readTemperature();
Serial.print("Temperature is= ");
Serial.println(a1);
Serial.print("Humidity is= ");
Serial.println(a2);
a3 = 1;
}
void convert2string()
{
Serial.print(“Received is= “);
Serial.println(m1);
if ((m1==””) || (m1==“0”))
{
c1=“9”;
c2=“9”;
c3=“9”;
s1=9;
s2=9;
s3=9;
a1=9;
a2=9;
a3=9;
}
else
{
// Serial.println(m1);
}
if(s1==1){
s1=2;
}
else{
s1=1;
}
if(s2==1){
s2=2;
}
else{
s2=1;
}
if(s3==1){
s3=2;
}
else{
s3=1;
}
ss1 = String(s1);
ss2 = String(s2);
ss3 = String(s3);
aa0 = String(a1);
aa1 = String(a2);
aa2 = String(a3);
}
void readytosend()
{
d = “?id=” + id + “&uid=” + uid + “&type=2”;
d += “&c1=” + c1 + “&s1=” + ss1;
d += “&c2=” + c2 + “&s2=” + ss2;
d += “&c3=” + c3 + “&s3=” + ss3;
d += “&a1=” + aa0;
d += “&a2=” + aa1;
d += “&a3=” + aa2;
d.toCharArray(buf,90);
//Serial.println(buf);
}