Jump to content

Display content of a HTML file


el_nino

Recommended Posts

hey... ;D

 

I have a postgreSQL database which contains URL's to HTML documents. I want to output the contents of this document on a particular page on my site. so far i have tried 'file_get_contents', 'include' and 'fopen' but dont seem to be getting anywhere. The code i am using is

 

<?php
            $sql="select * from jfs where issue = (select max(issue) from jfs) and format = 'html'";// selects the latest issue


            $result_set = pg_Exec ($conn, $sql);
            $rows = pg_NumRows($result_set);

            if ((!$result_set) || ($rows < 1)) {
                  echo "<H1>ERROR - no rows returned</H1><P>";
                  exit;  //exit the script
                  }

            for ($j=0; $j < $rows; $j++)
               {
               $issue = pg_result($result_set, $j, "issue");
               $page = pg_result($result_set, $j, "page");
               $author = pg_result($result_set, $j, "author");
               $title = pg_result($result_set, $j, "title");
               $format = pg_result($result_set, $j, "format");
               $url = pg_result($result_set, $j, "url");   

			//$url="http://google.co.uk/";
			//$home=readfile($url);
			include ("$url");
			//echo $home;



               }
?> 

<?php
        pg_FreeResult($result_set);
        pg_Close($conn);
?>

 

i know that my query my working as i am able to echo the url but cannot display the contents of the file

 

any help would be greatley appreciated

 

el nino

Link to comment
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.