views:

304

answers:

2

I set up a thing so that, from various places on my website, I can link to a page called "linktothis.php" which will include a link to the referring page. It works fine in firefox, but IE seems to give it trouble and it tells me:

Warning: fread(): supplied argument is not a valid stream resource in /usr/local/apache/sites/nextadvisor/linktothis.php on line 19

(line 19 is the 4th line below)

  <?php
  $filesource = $_SERVER['HTTP_REFERER'];
  $a = fopen($filesource,"r"); //fopen("html_file.html","r");
  $string = fread($a,1024);
  if (eregi("<linkto>(.*)</linkto>",
  $string, $out)) {
  $outdata = $out[1];
  }
  //echo $outdata;
  $outdatapart = explode( " " , $outdata);

  echo $part[0];

  if (empty($outdata)) if (eregi("<title>(.*)</title>",
  $string, $out)) {
  $outdata = $out[1];
  }
  //echo $outdata;
  $outdatapart = explode( " " , $outdata);

  echo $part[0];

  ?>

What do I need to switch so that this will work in IE?

+1  A: 

Could it be that your IE does not provide the referring page to your script? Try a var__dump($_SERVER) to verify that.

soulmerge
It appears that that's the case. What sort of workarounds are there for this?
pg
There is no workaround for this. The browser won't tell your php script where it's coming from.
soulmerge
A: 

It should be issue with $_SERVER['HTTP_REFERER'];. Try to echo this variable in Ie and see what it contains.

Alekc
It won't echo. When I echo it, it turns up blank.
pg