-1

I have the following script:

    <?php
    #ini_set('include_path', "c://mylocalserver//htdocs//mydirec//");
    #include ('list.php');
    ini_set('include_path', "http://xx.xx.xxx.xx/");
    include ("http://xx.xx.xxx.xx/list.php");
    foreach ($items as $mylist) {
    $output=$mylist['name'];
    echo 'NAME'.''."     ".''.$output."<br>";
    }

When the ini_set and inlcude is used for the mylocalserver the script runs and echos out the file content and the name and $output as desired, like it's suppose to. When I use the ini_set and include pointing to a remote server I get the file content in the browser, like its reading the file but not running the foreach. What am I missing? Thanks for any help

1 Answers1

2

Why to you use http://... in your include function and in the ini_set function?

If you really want to include a file from a remote host. Read following: including a remote file in PHP

Community
  • 1
  • 1
perber
  • 79
  • 7
  • I tried it wihout the http in the include but it would not even show the contents. Once I added the full path, it pulled it into the browser. Eventually the php script will be on the same server, I was testing it before I uploaded it. – B Todd Poole Mar 07 '15 at 22:53
  • hmm.. upload your files to your server. I think you have 2 files. One is including the other one. If you put all files together in the same directory you only have to write include(list.php) you dont need to set the include path normally. – perber Mar 07 '15 at 22:58
  • If you need to set the include_path you must look what the absolute path of the directory is like /var/www/whatever/includes – perber Mar 07 '15 at 23:01
  • Thanks for info, I will upload and edit from the server. – B Todd Poole Mar 08 '15 at 00:36