HTML Download
Posted: Wed Jan 14, 2004 5:17 am
Hi. I'm relatively new to PHP and am wondering if you can help me here.
I'm trying to write a script that will download an HTML page and then search through it for a specific phrase and do a few more things, but that's not important at this stage.
Problem is I'm having a bit of trouble 'allocating' the page to a variable. This is the code I have so far:
$html = implode ('', file ('http://www.domain-name.com'));
echo $html;
The problem is that $html seems to be empty or a string of length 0. I think this is because the site I want to get (not http://www.domain-name.com) requires authentication (which I do have), but I'm not sure. The specific page is also a Perl page (*.pl)
Is that likely to be why $html turns out to be empty or am I doing something wrong with the code.
Is there anyway to send the authentication using PHP? The login box is a msgbox type window thing (hope you know what I mean)
Thanks in advance,
Kramer
I'm trying to write a script that will download an HTML page and then search through it for a specific phrase and do a few more things, but that's not important at this stage.
Problem is I'm having a bit of trouble 'allocating' the page to a variable. This is the code I have so far:
$html = implode ('', file ('http://www.domain-name.com'));
echo $html;
The problem is that $html seems to be empty or a string of length 0. I think this is because the site I want to get (not http://www.domain-name.com) requires authentication (which I do have), but I'm not sure. The specific page is also a Perl page (*.pl)
Is that likely to be why $html turns out to be empty or am I doing something wrong with the code.
Is there anyway to send the authentication using PHP? The login box is a msgbox type window thing (hope you know what I mean)
Thanks in advance,
Kramer