This shouldn't be a complicated solution but it's somehow beyond me at the moment.

There is a php script on an external server that is writing javascript document.writes that we are supposed to include in our html files. However, we don't like the layout so I'm trying to strip the data we don't need(shouldn't be a problem) but for something reason I can't get php to read it. It's not a php problem, it's just I'm doing the wrong things.

I tried

$sitedata = include("link.to.file");
echo $sitedata;

That didn't work.

What's the right way of getting the data into a php variable so I can begin editing it?

Thanks.

    check the manual => file function:

    <?php
    // get contents of a file into a string
    $filename = "/usr/local/something.txt";
    $handle = fopen($filename, "r");
    $contents = fread($handle, filesize($filename));
    fclose($handle);
    ?> 
    

      Sorry about the double post. I thought I was editing the first one.

      Anyway here's the deal.

      I get
      Warning: fopen(https://www.setalert.com/code/message.php?key=d014a0acefd6c76e17d4433422331bea&aref=7Scwu4Y9cnL9&max=2&exp=&group[]=725) [function.fopen]: failed to open stream: Invalid argument in c:\apache\htdocs\bla.php on line 4

      and

      Allow_url_fopen is on in php.ini

      ==========================================================

      Okay I fixed the problem. It needed ssl support so I needed to enable the curl and openssl extensions in php. Then since I didn't know the file size of the script I used feof and while to find the end of the file.

      It's working great now. Thanks for the help.

        Write a Reply...