title: fopen with Internal URL in PHP
body: <p>We recently changed permissions on a folder (Windows Server 2012 R2 / IIS) to accommodate writing text files with PHP.  We can write test files when we use a relative path, but if we attempt to use the $url session variable or the URL itself it fails with (our URL is not public, but on a private internal network):</p>
  
  <blockquote>
    <p>PHP Warning:  fopen(txt/newfile.txt): failed to open stream: Permission denied in C:\inetpub\wwwroot\folder\file.php on line 3</p>
  </blockquote>
  
  <p>Line 3 (URL changed to maintain privacy): </p>
  
  <pre><code>$myfile = fopen("http://11.11.11.11/folder/txt/newfile.txt", "w") or die   
  ("Unable to open file!");
  </code></pre>
  
  <p>whereas this works:</p>
  
  <pre><code>$myfile = fopen("txt/newfile.txt", "w") or die   
  ("Unable to open file!");
  </code></pre>
  
  <p>I checked the php.ini and allow_url_fopen = On.  I can ask the developer to use the relative path, but I would love to know what is going on here and how to use the URL if we would like.</p>
  
  <p>Thanks!</p>