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

Matt Barton javascript at mattbarton.org
Wed Aug 11 06:48:16 CDT 2004


However, if http://www.mydomain.com/index.html contains header redirections
or is protected by .htaccess you might have trouble with
file_get_contents().  Not so sure about the redirections, it might handle
them, but I'm pretty sure that .htaccess authentication is beyond it.

cURL will get round both of the above though (as long as you know the
correct .htaccess username and password).

Matt

----- Original Message ----- 
From: "Roger Roelofs" <rer at datacompusa.com>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Wednesday, August 11, 2004 11:55 AM
Subject: Re: OT: cURL (was Re: [Javascript] Content Retrieval)


> Tim,
> 
> On Aug 11, 2004, at 6:05 AM, Matt Barton wrote:
> 
> > 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.
> >
> 
> 
> If you use php, curl is not necessary.
> 
> <?php
> 
> $var = file_get_contents("http://www.mydomain.com/index.html"); // puts 
> whole file in a string var
> 
> // if your php installation is older you can
> 
> $aVar = file("http://www.mydomain.com/index.html");  //puts file into 
> an array of lines
> $var = implode("\n", $aVar);                         //concatenates 
> array into string var
> 
> // extracting the required text is left as an exercise for the reader...
> 
> ?>
> 
> _______________________________________________
> 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