digitalrjs Posted September 3, 2008 Share Posted September 3, 2008 How can I pull html instead of documents using php and display it the same way? thispage.html contents thispage2.php (pulls content from thispage.html) echo the contents of thispage.html Link to comment https://forums.phpfreaks.com/topic/122580-php-pull-html-from-another-page/ Share on other sites More sharing options...
discomatt Posted September 3, 2008 Share Posted September 3, 2008 What? Link to comment https://forums.phpfreaks.com/topic/122580-php-pull-html-from-another-page/#findComment-632916 Share on other sites More sharing options...
digitalrjs Posted September 3, 2008 Author Share Posted September 3, 2008 This code can read documents and files. Do set it up as strings? <?php $dirpath = "images/news/"; $dl = opendir($dirpath); //limit characters while (false !== ($file = readdir($dl)) && $count < 3) { //admit sub directories if (!is_dir("$dirpath/$file")) { // $mod = filemtime("$dirpath/$file"); $files[$file] = $mod; // store in array //limit characters $limit = 6; //subtractstring $count++; } } closedir($dl); //Close Select asort($files); // sort array by date foreach ($files as $fn => $mod) { //$dt = date ('d M y H:i:s', $mod); echo " <br> <table> <tr> <td align='left'> <img src='images/pdf.jpg' alt='adobe pdf' align='left' height='24' hspace='8' vspace='0' width='25'> <a href='$dirpath/$fn'>".substr($fn,0,$limit). "</a> </tr> </td> </table> " ; } //echo "<a href='$dirpath/$fn'>$fn</a> ($dt) <br />"; ?> Link to comment https://forums.phpfreaks.com/topic/122580-php-pull-html-from-another-page/#findComment-632930 Share on other sites More sharing options...
discomatt Posted September 3, 2008 Share Posted September 3, 2008 I think you need to explain in more detail what you are trying to accomplish. Link to comment https://forums.phpfreaks.com/topic/122580-php-pull-html-from-another-page/#findComment-632934 Share on other sites More sharing options...
digitalrjs Posted September 3, 2008 Author Share Posted September 3, 2008 Here is the page this.html. <table border="0" width="517" height="160" align="left"> <tbody> <tr> <td colspan="3" valign="top"> <strong>August 19, 2008 <br> WEST WATEREE CHRONICLE <br> </strong><u><font color="#0000ff"><a href="images/emailupdates/duipdf.pdf" target="_blank" title="GENERAL 2008 LEGISLATIVE UPDATE">TOUGHER PENALTIES COULD REDUCE DUI FATALITIES - GUEST EDITORIAL BY JOEL LOURIE</a></font></u> <p> <strong>August 8, 2008 <br> </strong><u><font color="#0000ff"><a href="images/emailupdates/joellouriepdf.pdf" target="_blank" title="GENERAL 2008 LEGISLATIVE UPDATE">2008 LEGISLATIVE UPDATE</a></font></u> </p> <strong>July 17, 2008</strong><br /> <em><strong>THE COUNTRY CHRONICLE<br /></strong></em><u><font color="#0000ff"><a href="images/emailupdates/pdfonline.pdf" target="_blank" title="GENERAL ASSEMBLY TAKES STAND AGAINST DARFUR - GUEST EDITORIAL BY JOEL LOURIE">GENERAL ASSEMBLY TAKES STAND AGAINST DARFUR - GUEST EDITORIAL BY JOEL LOURIE</a></font></u><a href="images/emailupdates/nenewscigtax.pdf" target="_blank" title="The Northeast News - Raise the Cigarette Tax"><br /> <br> <strong>July 17, 2008</strong><br /> <em><strong>THE COUNTRY CHRONICLE<br /></strong></em><u><font color="#0000ff"><a href="images/emailupdates/pdfonline.pdf" target="_blank" title="GENERAL ASSEMBLY TAKES STAND AGAINST DARFUR - GUEST EDITORIAL BY JOEL LOURIE">GENERAL ASSEMBLY TAKES STAND AGAINST DARFUR - GUEST EDITORIAL BY JOEL LOURIE</a></font></u><a href="images/emailupdates/nenewscigtax.pdf" target="_blank" title="The Northeast News - Raise the Cigarette Tax"><br /> <br> <strong>July 17, 2008</strong><br /> <em><strong>THE COUNTRY CHRONICLE<br /></strong></em><u><font color="#0000ff"><a href="images/emailupdates/pdfonline.pdf" target="_blank" title="GENERAL ASSEMBLY TAKES STAND AGAINST DARFUR - GUEST EDITORIAL BY JOEL LOURIE">GENERAL ASSEMBLY TAKES STAND AGAINST DARFUR - GUEST EDITORIAL BY JOEL LOURIE</a></font></u><a href="images/emailupdates/nenewscigtax.pdf" target="_blank" title="The Northeast News - Raise the Cigarette Tax"><br /> </a> </td> </tr> </tbody> </table> I need php code where I can pull the list of pdf the way it is but the first 3. Link to comment https://forums.phpfreaks.com/topic/122580-php-pull-html-from-another-page/#findComment-632942 Share on other sites More sharing options...
discomatt Posted September 3, 2008 Share Posted September 3, 2008 Where are you getting this file from. It's horribly formatted. There are duplicate entries and some anchor tags that aren't even closed. You're gonna wanna use regex to parse this file, but I'm not going to attempt it with such inconsistent formatting. There are duplicate titles with different anchor text, duplicate anchors, and as stated before, unclosed anchor tags. If you can give me a clean source I can write to a regex to scrap the URLs. Link to comment https://forums.phpfreaks.com/topic/122580-php-pull-html-from-another-page/#findComment-632954 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.