SV650.org - SV650 & Gladius 650 Forum

SV650.org - SV650 & Gladius 650 Forum (http://forums.sv650.org/index.php)
-   Idle Banter (http://forums.sv650.org/forumdisplay.php?f=116)
-   -   Small PHP issue (http://forums.sv650.org/showthread.php?t=67844)

TSM 15-03-06 05:55 PM

Small PHP issue
 
Odd problem. I have a small php file that just proxys the data from one page to another so that the end user does not know the original url. Problem i am having is that it works on one machine and not the other.

Code:

  $dataFile = fopen( "http://xx.xx.xx, "r" ) ;

  if ( $dataFile )
  {
  while (!feof($dataFile))
  {
      $buffer = fgets($dataFile, 4096);
      echo $buffer;
  }

  fclose($dataFile);
  }
  else
  {
  die( "fopen failed" ) ;
  }

The code above works on my home machine but not on my webserver. I might have to use fsockopen instead as that works fine.

Any Ideas why? Not a major problem though.

OS: XPSP2, IIS

mac 15-03-06 06:06 PM

I wish i understood one word of that

:oops:

Gnan 15-03-06 06:45 PM

are you escaping the backslashes in your URL? is your local webserver running linux?

there's a few problems with fopen() in a lot of PHP versions

personally i'd not bother with it and use curl

TSM 15-03-06 07:08 PM

Quote:

Originally Posted by Gnan
are you escaping the backslashes in your URL? is your local webserver running linux?

there's a few problems with fopen() in a lot of PHP versions

personally i'd not bother with it and use curl

nop is an IIS server so i dont have the curl option.

I guess i will have to use fsockopen

Sudoxe 15-03-06 07:13 PM

bloody long way round, try this
<?
require ("http://www.x.x.x.x");
?>

or

<?
include ("http://www.x.x.x.x");
?>

TSM 15-03-06 07:20 PM

Nop does not work either. Weird there may be a problem in php on IIS.


All times are GMT. The time now is 03:55 PM.

Powered by vBulletin® - Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.