0

Could somebody suggest the simplest way forward for me to investigate please?
Please take a look at this web page which shows a single record of a mysql db http://www.swaag.org/DB_VIEW_Specific%20Record%20Number2.php?swaagrec=591
I would like to be able to create a program where I can select for example records 1 to 100 and it will print them out in the same format as the above link displays them. i.e. data and images -> rec1 followed by rec2, rec3, rec4 etc. Like the display program I would like it to ignore empty data fields.
Only links to the images are in the database, the images are stored in another folder.
Ultimately I would like the output be a .pdf, but I am happy with any other file format which can be converted.
? .html or .doc
Is there a simple way of achieving this using the php code I use to display the above page within a loop?

Thanks for your time.

Stephen

2
Contributors
2
Replies
5
Views
5 Years
Discussion Span
Last Post by stephen_UK
0

Hi,

Do you own the site? Yes -> use cache and save it as html file. No-> use HTML parser like simple DOM parser.

WARNING! Be careful when using DOM parsers. You can either ask permission from the site owner to harvest and save the data from their site..

Example code for cache method.. If you search my previous post, I posted a class for this.

<?php

ob_start(); 

include_once('contentPage.php');
## prepare for writing the cache file

    $filePointer = fopen('hardCopy.html', 'w');

    ## grab the output buffer and write it in cachefile
    fwrite($filePointer, ob_get_contents());

    ## close the file
    fclose($filePointer);

    ## Send the output to the browser
     ob_end_flush();

The above codes can and will work with cURL or simple HTML DOM parser. The hardCopy.html is the copy of the contenPage.php output as shown on the browser.

0

Many thanks for your response. I will try the cache solution out.
Cheers
Stephen

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.