Re: Subject: Getting HTML Content as a variable

From: Date: Sat, 18 Jan 2003 18:20:13 +0000
Subject: Re: Subject: Getting HTML Content as a variable
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-17965@lists.php.net to get a copy of this message
Hi Greg - dunno about (1) myself :-) Would be interested to hear, but I assume it involves appending these values to the hostname you are acquiring the data from. By analogy with the ftp:// url scheme, I imahine you can do it like this - try it and let us know if it worked for you : http://user:pass@www.whatever.com/ This will depend I guess on the authentication scheme at the other end - if it requires cookies or filling in a form I guess you're buggered - your milage may vary etc etc. In answer to (2) : When you rewrite the HTML, add the following to the top of your HTML output : <BASE href="http://192.168.1.100"> or whatever the hostname is you acquired the files from. Its a standard HTML tag. That will point all absolute paths to the system root on the specified server. HTH Neil Smith. At 15:13 18/01/2003 +0000, you wrote:
From: php@interdatacentral.com To: php-windows@lists.php.net Message-Id: <200301180543250.SM01120@mail.interdatacentral.com> Subject: Getting HTML Content as a variable Hi, I've been directed to use file() or implode() to get the html content of a web page, like this: $html = implode ('', file ('http://192.168.1.100/PHP/index.php')); 1 ) How do I pass authentication to websites that require username & password? In Cold Fusion the CFHTTP tag allows you to pass USERNAME="myusername" PASSWORD="mypassword", there must be an equivalent parameter in PHP. 2) When I output the content of $html, which is the web page stored as a variable, the images are not there. Again, in Cold Fusion the CFHTTP tag takes care of this when you specify RESOLVEURL="YES", and I'm guessing there is a way in PHP to store the web page WITH images intact? thanks! ph_Greg


« previous php.windows (#17965) next »