FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » From city to lati and long
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: From city to lati and long [message #175031 is a reply to message #175030] Thu, 04 August 2011 19:17 Go to previous messageGo to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On Thu, 04 Aug 2011 14:24:31 -0400, Jerry Stuckle wrote:

> If you read her post, sometimes the code works and sometimes it fails -
> with *exactly the same parameters*. The problem is NOT the PHP code.

Yes, and perhaps using a better method (curl vs file) for getting the web
page might enable her to determine that sometimes she gets something
other than the data that is expected. For example, maybe she gets a 4xx
page and is trying to parse the first line of that with explode?

Her error then would be failing to handle the 4xx page appropriately, or
even treating it as valid data.

Likewise validating that the contents of the received file met some basic
criteria might help detect errors, and knowing what was being received
when invalid data was generated by the explode could certainly help in
determining what was causing the problem.

But I'm glad that you reject all of these possible php steps she could
take to identify and solve her problem as irrelevant to discuss here
because her problem doesn't fit your smallworld view of a php problem.

As I said, the underlying problem might not be the php code, but surely
just as it is good practice to validate and verify everything one
receives as form input before doing any calculations with it, so it is
also a good idea to validate and verify that any data obtained from an
external server is in an expected format before attempting to process it
further ... which is part of what I am suggesting she do. The other parts
of what I am suggesting she do are to use functions that give her a finer
degree of control and feedback over the http request she makes, and that
if she does detect an error, she records as much of the relevant data as
possible for analysis to help determine the fault. These are all things
that she can do in php that may help her discover what the issue is and
find ways in php to mitigate (wait a few secs and retry the request
perhaps if she gets an "upstream server error" or timeout type response)
or gracefully fail.

Rgds

Denis McMahon
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: What is Islam?
Next Topic: Using function prototypes in code
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 09:03:49 GMT 2024

Total time taken to generate the page: 0.05509 seconds