l3rodey Posted November 1, 2013 Share Posted November 1, 2013 The title is crap sorry I am bad with titles. I have a database which is id domain 1 www.google.com There is a few other tables but they don't matter for this, I am wanting to get the server response from all my websites and setup a cron job. I am able to get it to send me an email when it fails and so on but what I cannot do it get it to repeat for all the urls I can only do one? I have this: <?phpfunction get_contents() { file_get_contents("http://example.com"); var_dump($http_response_header);}get_contents();var_dump($http_response_header);?> Which out puts this: array(9) {[0]=>string(15) "HTTP/1.1 200 OK"[1]=>string(35) "Date: Sat, 12 Apr 2008 17:30:38 GMT"[2]=>string(29) "Server: Apache/2.2.3 (CentOS)"[3]=>string(44) "Last-Modified: Tue, 15 Nov 2005 13:24:10 GMT"[4]=>string(27) "ETag: "280100-1b6-80bfd280""[5]=>string(20) "Accept-Ranges: bytes"[6]=>string(19) "Content-Length: 438"[7]=>string(17) "Connection: close"[8]=>string(38) "Content-Type: text/html; charset=UTF-8"}NULL Which I found on google. So if I get the server response I can do this for one website that's fine what I don't know how to do is have 1 php script as a cron job go through and check every url in my database I will have like 200. and if 1 = say 500 error then to send an email. that is fine but yeah. I think I explained enough. I am bad with arrays as well so I don't even know how to just echo out the server response as in 404, 200, 500 ,301 and so on that's really all I need then I can do if($response == 404){ email }elseif($response == 500){ send a different email } Any help is great help! thanks Link to comment https://forums.phpfreaks.com/topic/283500-doing-the-same-script-but-for-entire-database/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.