bostboy — 2010-10-14T10:48:26-04:00 — #1
In a simple example of geocoding with Yahoo placefinder, I am getting a return but my understandinig is the return is supposed to be xml. I am just getting a plain string. Am I supposed to be setting something else? I am under the impression their return default is xml. While I can certainly parse the string to find lat/long, anything else would be difficult I think.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "where.yahooapis.com/geocode?location=15+marrett+rd,+lexington,+ma&appid=xxxx");
curl_setopt($ch, CURLOPT_VERBOSE, 1);
$output = curl_exec($ch);
Any ideas how to get this in an xml format?
bostboy — 2010-10-19T09:41:11-04:00 — #2
Never mind, it's "text/plain", correct?
salathe — 2010-10-14T11:19:57-04:00 — #3
Don't output the
$output as HTML else you won't see it properly! Before you output anything write the line
ini_set('default_mimetype', 'text/plain'); (you also won't need the
bostboy — 2010-10-14T12:09:12-04:00 — #4
Many thanks. That works great.
anthonysterling — 2010-10-19T10:12:22-04:00 — #5
Salathe has already pointed it out.
bostboy — 2010-10-19T08:57:08-04:00 — #6
Stupid question, set it to "text" or "plain text"?
salathe — 2010-10-14T12:26:27-04:00 — #7
For what it's worth, you can also set that INI option within your php.ini file (on the server/computer that you develop your code on) to output, by default, as plain text. The default of HTML (
text/html) can be exceptionally annoying and is the cause of lots of questions like yours here.