Re: Re: How to get PHP to download web contents

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Steve B." <stylinsty@yahoo.com> wrote in message
20030703233946.58370.qmail@web41505.mail.yahoo.com">news:20030703233946.58370.qmail@web41505.mail.yahoo.com...
> Hi Nadim,
> It works but not for sites with password window that pops up.
I see.
That is HTTP Basic Authentication
You should use this line:
$filename = 'http://someuser:somepwd@somesite.com/';
instead of:
$filename = "http://somesite.com?user=someuser&pwd=somepwd;

and source will look like:
<?php
// get contents of a file into a string
$filename = 'http://someuser:somepwd@somesite.com/';
$handle = fopen ($filename, "r");
$contents = fread ($handle, filesize ($filename));
fclose ($handle);
?>

nadim's solution will look like this:
$html = implode ('', file ('http://someuser:somepwd@somesite.com/'));





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux