title: failed to open stream: Permission denied file_get_contents which generates XML FILE
body: <p>I am trying to generating an XML file, but error come in this <a href="http://in1.php.net/file_get_contents" rel="nofollow"><code>file_get_contents()</code></a> PHP function, this is my code:</p>
  
  <pre><code> function mobile_login1($P1, $P2)
  {
      $url = 'myURL';
      $data = array(
          'username' =&gt; $P1,
          'password' =&gt; $P2);
  
      // use key 'http' even if you send the request to https://...
      $options = array(
          'http' =&gt; array(
              'header'  =&gt; "Content-type: application/x-www-form-urlencoded",
              'method'  =&gt; 'POST',
              'content' =&gt; http_build_query($data),
          ),
      );
      $context  = stream_context_create($options);
      $json_data = file_get_contents($url, false, $context);
  
  
              $decode = json_decode($json_data);
  
              //print_r ($decode[0]);
              //
  
              foreach($decode as $row)
              {
                  $data[] = array("Message" =&gt; $row-&gt;msg);
  
  
              }
  
  
              //print_r ($data[0]['Message']);
  
              $msg = $data[0]['Message'];
  
              if ($msg == 'Incorrect username/password')
              {
  
  
                   $this-&gt;response['ResponseCode'] = "1000";
                   $this-&gt;response['ResponseMessage'] = $msg;
                   $this-&gt;response['ResponseData'] = $data;
              }
  
              else
              {
                  if($decode != null)
                  {
                      foreach($decode as $row)
                      {
                          $data[] = array("AccountId" =&gt; $row-&gt;a_id,
                                          "PersonalId" =&gt; $row-&gt;p_id,
                                          "FullName" =&gt; $row-&gt;full_name,
                                          "AccountName" =&gt; $row-&gt;a_name,
                                          "AccountType" =&gt; $row-&gt;a_type,
                                          "WalletBalance" =&gt; $row-&gt;wallet_balance,
                                          "PersonalAddress" =&gt; $row-&gt;p_add,
                                          "CompanyName" =&gt; $row-&gt;company_name,
                                          "CompanyAddress" =&gt; $row-&gt;company_add,
                                          "Fax" =&gt; $row-&gt;fax,  
                                          "PersonalMobile" =&gt; $row-&gt;p_mobile,
                                          "PersonalTelephone" =&gt; $row-&gt;p_tel,
                                          "Limit" =&gt; $row-&gt;limit,
                                          "Role" =&gt; $row-&gt;role,
                                          "AccountMobile" =&gt; $row-&gt;a_telno);
                      }
  
  
                      $this-&gt;response['ResponseCode'] = "0000";
                      $this-&gt;response['ResponseMessage'] = "successful";
                      $this-&gt;response['ResponseData'] = $data;
                  }
                  else
                  {
                      $this-&gt;response['ResponseCode'] = "1000";
                      $this-&gt;response['ResponseMessage'] = "no records found";
                  }   
              }
             //return $json_data;
  
  
      }
  </code></pre>
  
  <p>when i try to call my URL error come is the Line Number <code>187</code> is the code where my <strong>file_get_contents()</strong> function. </p>
  
  <pre><code>A PHP Error was encountered Severity: Warning Message: 
  file_get_contents(http://myURL/mobile_login): failed to open stream: Permission denied 
  Filename: models/accounts_model.php Line Number: 187
  </code></pre>
  
  <p><strong>Is this server fault or PHP error?</strong></p>