[thelist] php - including or reading a file on another website
Bob Meetin
bobm at dottedi.biz
Fri Apr 17 19:25:08 CDT 2009
This seems simple enough, but perhaps I'm not using the right function
to read or fetch a file off another site so that it can be used as a
list in an array? If I use include without http it reads the file and
runs through the array. If I attempt to include the http path it sees
the file but will not go through the array. What is the right way to
reference and include a file that is not local, i.e. on a different website?
<?php
#include ("list.php"); // this works perfectly with a local file
include ("http://www.dottedi.biz/scripts/list.php"); // doesn't work
$my_array = explode ("\n", $list);
foreach ($my_array as $my_value)
{
if ( strlen($my_value) > 0 )
{
echo "Value: $my_value<br >";
}
}
?>
-------------------------------- contents of
www.dottedi.biz/scripts/list.php -------------------------------
<?php
$list = "
1
2
3
4
5
";
?>
More information about the thelist
mailing list