Getting data from a web page

Hi,

I'm using php 4.4.4. What I want to do is hopefully simple. If I
type this URL into my browser:

http://maps.google.com/maps/geo?q=980+PEMART+AVE+PEEKSKILL,+ NY+10566&output=csv&key=ABQIAAAAuHEWowxYzDRtZwy5bJee6RRepaxJ 09NBCcZ4ddHPnTvG1CBwlxTqGOXX0DHtp5WHcsP7cJ-K0vvurg

I get a simple comma-delimited list of data. What I would like to do
is in my PHP script, request this URL and then put the return values
into an array. How do I do this?

Thanks, - Dave
laredotornado [ Mi, 30 Januar 2008 21:34 ] [ ID #1920347 ]

Re: Getting data from a web page

laredotornado [at] zipmail.com wrote:

> http://maps.google.com/maps/geo?q=980+PEMART+AVE+PEEKSKILL
+NY+10566&output=csv&key=ABQIAAAAuHEWowxYzDRtZwy5bJee6RRepax J09NBCcZ4ddHPnTvG1CBwlxTqGOXX0DHtp5WHcsP7cJ-K0vvurg
>
> I get a simple comma-delimited list of data. What I would like to do
> is in my PHP script, request this URL and then put the return values
> into an array. How do I do this?

Use CURL functions to get the data, then use string functions to parse the
data into an array.


Cheers,
--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

God is real (unless declared integer).
ivansanchez-alg [ Mi, 30 Januar 2008 22:10 ] [ ID #1920348 ]

Re: Getting data from a web page

On Jan 30, 12:34 pm, "laredotorn... [at] zipmail.com"
<laredotorn... [at] zipmail.com> wrote:
> Hi,
>
> I'm using php 4.4.4. What I want to do is hopefully simple. If I
> type this URL into my browser:
>
> http://maps.google.com/maps/geo?q=980+PEMART+AVE+PEEKSKILL,+ NY+10566&...
>
> I get a simple comma-delimited list of data. What I would like to do
> is in my PHP script, request this URL and then put the return values
> into an array. How do I do this?
>
> Thanks, - Dave

You will want to read up on the CURL library and the term scrape or
google for curl and scrape, that should give you hits on what you want
to do.

Scrape sounds kinda bad and if you don't have permission to read
someones data off a page you could get in trouble. Google has
information aout what you can collect from their pages and for what
purpose.
Larry Anderson [ Mi, 30 Januar 2008 22:13 ] [ ID #1920349 ]

Re: Getting data from a web page

Hello,

on 01/30/2008 06:34 PM laredotornado [at] zipmail.com said the following:
> I'm using php 4.4.4. What I want to do is hopefully simple. If I
> type this URL into my browser:
>
> http://maps.google.com/maps/geo?q=980+PEMART+AVE+PEEKSKILL,+ NY+10566&output=csv&

key=ABQIAAAAuHEWowxYzDRtZwy5bJee6RRepaxJ09NBCcZ4ddHPnTvG1CBw lxTqGOXX0DHtp5WHcsP7cJ-K0vvurg
>
> I get a simple comma-delimited list of data. What I would like to do
> is in my PHP script, request this URL and then put the return values
> into an array. How do I do this?

For simple requests like that, you can just call:

$csv = file_get_contents('http://maps.google.com/maps/geo?
q=980+PEMART+AVE+PEEKSKILL,+NY+10566&output=csv
&key=ABQIAAAAuHEWowxYzDRtZwy5bJee6RRepaxJ09NBCcZ4ddHPnTvG1CB wlxTqGOXX0DHtp5WHcsP7cJ-K0vvurg');


--

Regards,
Manuel Lemos

PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Manuel Lemos [ Do, 31 Januar 2008 00:39 ] [ ID #1920355 ]

Re: Getting data from a web page

On Jan 30, 3:34 pm, "laredotorn... [at] zipmail.com"
<laredotorn... [at] zipmail.com> wrote:
> Hi,
>
> I'm using php 4.4.4. What I want to do is hopefully simple. If I
> type this URL into my browser:
>
> http://maps.google.com/maps/geo?q=980+PEMART+AVE+PEEKSKILL,+ NY+10566&...
>
> I get a simple comma-delimited list of data. What I would like to do
> is in my PHP script, request this URL and then put the return values
> into an array. How do I do this?
>
> Thanks, - Dave

$url = 'http://maps.google.com/maps/geo?q=980+PEMART+AVE+PEEKSKILL, +NY
+10566&...';
$arr = explode(',', file_get_contents($url));
zeldorblat [ Do, 31 Januar 2008 00:46 ] [ ID #1920356 ]

Re: Getting data from a web page

On Jan 30, 12:34 pm, "laredotorn... [at] zipmail.com"
<laredotorn... [at] zipmail.com> wrote:
>
> If I type this URL into my browser:
>
> http://maps.google.com/maps/geo?q=980+PEMART+AVE+PEEKSKILL,+ NY+10566&...
>
> I get a simple comma-delimited list of data. What I would like to do
> is in my PHP script, request this URL and then put the return values
> into an array. How do I do this?

$URL = 'http://maps.google.com/maps/geo?q=...';
$dataArray = explode(',', trim(file_get_contents($URL)));

Cheers,
NC
nc [ Do, 31 Januar 2008 04:34 ] [ ID #1921044 ]
PHP » comp.lang.php » Getting data from a web page

Vorheriges Thema: Rotate 3D Imagen in PHP GD ?
Nächstes Thema: curl attack prevention