Jump to content

read a text file into my web page


jimneely

Recommended Posts

I have my main page set up as html. I am using php to pull in a text file. I can (on its own) read a text file but when i add the php code to the html it does not work. Help please.

 

<?php

 

/**

*

*

*

 

@version $Id$

*

 

@copyright 2014

*/

// Read 14 characters starting from the 21st character

//$section = file_get_contents('./people.txt', NULL, NULL, 20, 14);

//$section = file_get_contents('C:/users/jneely/desktop/test.txt', true);

//$section = file_get_contents('\\s-dmf\data\M200\TM-0731\FunctionTest\Archive\14011623595241162401B.txt', true);

$section

 

= file_get_contents('//s-fs2/attachments/test.txt', true);

//var_dump($section);

echo(

$section);

 

?>

 

My html.....

 

$rightcolumn

 

= <<< EOF

<a href="http://example1.com/">QPR</a>

<br/><a href="http://example2.com/">Deviation</a>

<br/><a href="http://example3.com/">Boundary Samples</a>

<br/><a href="http://example4.com/">TPC</a>

<br/><a href="http:readtextfile.php">Test</a>

<br/><a href="http://example6.com/">Link 6</a>

EOF

 

 

;

 

Link to comment
https://forums.phpfreaks.com/topic/285640-read-a-text-file-into-my-web-page/
Share on other sites

What exactly do you expect your anchor tag for readtextfile.php to do? If you want it to load that PHP file, you need to fix the href to actually point to that file, right now it's pointing to some non-existent http:readtextfile.php.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.