OT: cURL (was Re: [Javascript] Content Retrieval)

Matt Barton javascript at mattbarton.org
Wed Aug 11 05:05:54 CDT 2004


Can't provide you with an example I'm afraid, but I can direct you to cURL,
and let you know what it does.  You might be lucky - it might already be
installed on the machine thats hosting your site.

The place to learn all about cURL is: http://sourceforge.net/projects/curl/
or http://curl.haxx.se/

It's does far more than just 'fetch a web page', but that is all I have used
it for in the past.  On the linux command line you can run the curl program
and pass a url as an argument - it will return the response of that page to
std out.

You can, therefore, write a php (for example) script which executes a cURL
command and passes the html into a variable.  You can then use a nifty
regexp to extract the parts you want from the page.

Learn more by looking through the links I've included above.

There's probably 101 better ways to do this, and I've not worked with
php/linux professionally for 12 months now, so haven't seen recent versions
which may have better ways to do this, but this is exactly the technique I
used some time ago to form part of a professional solution for a UK ISP I
worked for.

HTH

Matt

----- Original Message ----- 
From: "Tim Makins" <spindrift at oceanfree.net>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Wednesday, August 11, 2004 10:59 AM
Subject: Re: [Javascript] Content Retrieval


> I am hosted with http://www.ipowerweb.com on a Linux machine, with
> Perl5.8.1, PHP4.3.4 and MySQL4.0.20 (very good company, by the way - I am
> 100% happy with their service)
>
> Please can you explain further about 'curl'. Do you have an example I
could
> see, please ?
>
> Tim in Ireland.
>
> ----- Original Message ----- 
> From: "Matt Barton" <javascript at mattbarton.org>
> To: "[JavaScript List]" <javascript at LaTech.edu>
> Sent: Wednesday, August 11, 2004 9:56 AM
> Subject: Re: [Javascript] Content Retrieval
>
>
> > Morning.
> >
> > You could use the xmlhttp activeX control to do this client-side in IE,
> but
> > whenever I've had to do this before, I've found a server-side approach
> much
> > more useful (no browser compatibility issues).  I have used curl on a
*nix
> > platform to get the webpage and then extract the required strings - and
> that
> > worked perfectly.  But for that you'd need a *nix server - I'm not sure
> what
> > you would do if your server was a windows machine... (perhaps a
> server-side
> > implementation of xml-http???)
> >
> > Do you have scope for a server-side approach, or is it a client side
> > solution you want?  If it's server-side, what is the platform?
> >
> > Matt
> >
> > ----- Original Message ----- 
> > From: "Tim Makins" <spindrift at oceanfree.net>
> > To: "[JavaScript List]" <javascript at LaTech.edu>
> > Sent: Wednesday, August 11, 2004 9:45 AM
> > Subject: [Javascript] Content Retrieval
> >
> >
> > > There is a webpage on the web that has dynamic content. On this page,
> two
> > > text strings always appear in the same place. I would like to retrieve
> > these
> > > text strings and place them in a variable on my own page. Any ideas ?
> > >
> > > Tim in Ireland.
> > >
> > > _______________________________________________
> > > Javascript mailing list
> > > Javascript at LaTech.edu
> > > https://lists.LaTech.edu/mailman/listinfo/javascript
> > >
> > > -- 
> > > This email has been verified as Virus free
> > > Virus Protection and more available at http://www.plus.net
> >
> > _______________________________________________
> > Javascript mailing list
> > Javascript at LaTech.edu
> > https://lists.LaTech.edu/mailman/listinfo/javascript
> >
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
> -- 
> This email has been verified as Virus free
> Virus Protection and more available at http://www.plus.net




More information about the Javascript mailing list