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
20030703065739.27186.qmail@web41509.mail.yahoo.com">news:20030703065739.27186.qmail@web41509.mail.yahoo.com...
> How would you get PHP to download a file such as a web page and put it in
a string?

Try this:
<?php
// get contents of a file into a string
$filename = "http://somesite.com?user=someuser&pwd=somepwd";;
$handle = fopen ($filename, "r");
$contents = fread ($handle, filesize ($filename));
fclose ($handle);
?>
$contents is disired string variable.
Best regards,
Ognyan

>
> What keywords would relate to this (besides php download)
>
> I need a user to be able to put in a name and pass and have PHP go to a
cetain site.
> The site can take the user/pass in the url so I do not need a form submit.
> Then I need the site contents to be in a php variable.
> Any tips on parsing html out of it would be great.
>
> Thanks
>
>
>
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.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