Re: put result of "include" into a variable

From: Date: Fri, 22 Nov 2002 22:41:46 +0000
Subject: Re: put result of "include" into a variable
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-125685@lists.php.net to get a copy of this message
For some (strange, I know) reason I would like to copy the content of a webpage into a database. I would like to have code like $whocares = include ("http://www.microsoft.nl"); $query = "insert into html values ($whocares,...)"; .. However, include can not copy the content to a variable. Does anyone have an idea how to circumvent this problem?
Try: $fp = fopen ("http://www.example.com/", "r"); $data = ""; while(!feof($fp)) { $data .= fread($fp,1024); } //$data now contains all the html for the website fclose($fp); -- Kyle Gibson admin(at)frozenonline.com http://www.frozenonline.com/

« previous php.general (#125685) next »