Include Problem
| From: | Wei, Alice J. | Date: | Tue, 24 Jun 2008 15:45:50 +0000 |
| Subject: | Include Problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-275889@lists.php.net to get a copy of this message | ||
Hi, Guys:
Here is a strange scenario that I am attempting to do. I am trying to extract some information
from an external source on a different server, and then include some of the external calculations as
I am running scripts on a local machine.
Below is my script snippet:
// Get a file into an array. In this example we'll go through HTTP to get
// the HTML source of a URL.
$lines2 = file("http://www.mysite.com/lung.txt");
$file2="http://www.mysite.com/lung.txt";
echo "<h2>This is the file for <b>$file2:</b></h2>";
// Loop through our array, show HTML source as HTML source; and line numbers too.
foreach ($lines2 as $line_num => $line2) {
echo "<p>Line #<b>{$line_num}</b> : " . htmlspecialchars($line2) .
"</p>";
}
include ('http://www.mysite.com/calculate.php');
My problem is that when I use a blank file that only has
<?php include 'http://www.mysite.com/calculate.php';
?>
The code works and displays what is meant to display. However, when I copy this snippet into the
code even outside the foreach loop, it does not even read, or give me an error. Is there something I
should not be doing here?
I welcome any suggestions.
Alice
======================================================
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
ajwei@indiana.edu