Closed Thread Icon

Topic awaiting preservation: fsocket open - detecting '500' errors? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12844" title="Pages that link to Topic awaiting preservation: fsocket open - detecting &amp;#039;500&amp;#039; errors? (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: fsocket open - detecting &#039;500&#039; errors? <span class="small">(Page 1 of 1)</span>\

 
Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 08-02-2003 20:34

Howdy!

Okay - seems I've run into a minor issue here. http://www.macombsheriff.com/dev/get_psor.phps is the source. It grabs data from a state database and dumps them into mine. It runs via cron once a day.

Seems the state database (http://mipsor.state.mi.us) is throwing 500 errors (at least since this morning). Well, the way we're doing this is getting all of the data each day. So, when we go to toss it into the database, we empty the tables of the existing data, then insert the new data. You'll see near the top of the maxParseZIP($zip) function that I send an email saying it didn't update, then, after the 'exit' (where I 'assume' it's safe to continue), I empty the tables. This has worked ok if the site is down (inaccessible), but this doesn't work for 500 errors. Now it empties the tables, and, since there is no new data, leaves them empty.

Any recommendation on how I can verify a little better? I'd rather have the old data (yesterday's), than to have NO data. Up until now, it's worked great.


And on a unrelated note, the $ZIPs array is hardcoded near the bottom. I'd rather pull it from an existing table in the db (I reuse that table elsewhere on the site and it is the most complete list). What's the best way for 'selecting' the data and then using it in the script?

Thanks!

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 08-02-2003 20:50

Pugzly: I'll speak to you via ICQ

___________________
Emps

FAQs: Emperor

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 08-02-2003 20:54

Add the following code below fclose($fp);

if (strpos($data, "HTTP/1.1 500 Server Error") !== false) { // <-- TWO equal signs!
&nbsp;&nbsp;&nbsp;&nbsp;print("Cannot fetch PSOR data! :-(\nServer returned 500 Server Error!");
&nbsp;&nbsp;&nbsp;&nbsp;exit;
}



« BackwardsOnwards »

Show Forum Drop Down Menu