title: file_get_contents php and json_decode error
body: <p>I am facing a weird problem with <strong>file_get_contents</strong> and decoding to json the result. I have to tell you that this code was fully functional in other server.</p>
  
  <p>I am trying to decode this json: 
  <a href="http://mediarupt.com/GET/categorized_services_for_supplier.php?suppliersID=10" rel="nofollow">http://mediarupt.com/GET/categorized_services_for_supplier.php?suppliersID=10</a></p>
  
  <p>into this page: 
  <a href="http://mediarupt.com/kostas.php" rel="nofollow">http://mediarupt.com/kostas.php</a></p>
  
  <p>The code for kostas.php is this:</p>
  
  <pre><code>&lt;?php 
  $servicesJSON = file_get_contents("http://mediarupt.com/GET/categorized_services_for_supplier.php?suppliersID=10");
  $ForeignKeys = (object)array();
  $ForeignKeys-&gt;ServicesList = json_decode($servicesJSON, true);
  
  echo "error: " . json_last_error();
  
  ?&gt;
  
  &lt;select name="servicesID" id="servicesID"&gt;
      &lt;option id="serviceID_0" value="0" rel="0" style="font-style:italic;"&gt;Select a category...&lt;/option&gt;
  &lt;?php foreach($ForeignKeys-&gt;ServicesList['categorized_services'] as $value){ ?&gt;
      &lt;option id="serviceID_&lt;?=$value['servicesID']?&gt;" value="&lt;?=$value['servicesID']?&gt;" rel="&lt;?=$value['hasStoresList']?&gt;"&gt;&lt;?=$value['serviceName']?&gt;&lt;/option&gt;   
  
  &lt;?php } ?&gt;
  
  &lt;/select&gt;
  &lt;?php
  
  echo '&lt;br&gt;&lt;br&gt;The result of file_get_contents ($servicesJSON): '.$servicesJSON;
  
  ?&gt;
  </code></pre>
  
  <p>Code for categorized_services_for_supplier.php:</p>
  
  <pre><code>&lt;?php header('Content-Type: application/json');
      require('../settings/dbli.php');
  
      $table = array();
      $suppliersID = "0";
  
      if(isset($_GET['suppliersID']) &amp;&amp; $_GET['suppliersID']!=NULL &amp;&amp; $_GET['suppliersID']!='' ){  $suppliersID = $SQLConn-&gt;real_escape_string($_GET['suppliersID']); }
      $query = "SELECT DISTINCT Services.servicesID, serviceName, servicePrice, hasStoresList FROM Services, ServicesList WHERE Services.servicesID = ServicesList.servicesID AND suppliersID = '$suppliersID' AND  status = '1' AND deleted = '0'";
  
      $result = $SQLConn-&gt;query($query);  
       while ($row = $result-&gt;fetch_array(MYSQLI_ASSOC)) {
          $tempArray = array();
          foreach($row as $key =&gt; $value){
              $tempArray[$key] = $value;                      
          }
          array_push($table,$tempArray);
       }
       $arr = array( "categorized_services" =&gt; $table);
      echo json_encode($arr);
  ?&gt;
  </code></pre>
  
  <p>I receive error <strong>4</strong> as latest json error, which means that I have <strong>JSON_ERROR_SYNTAX</strong>.
  But I validate the json result with <a href="http://jsonlint.com/" rel="nofollow">http://jsonlint.com/</a> and all seems to be ok.</p>
  
  <p>Also, both pages are UTF-8 with BOM disabled.
  You can access php configurarion here: <a href="http://mediarupt.com/phpinfo.php" rel="nofollow">http://mediarupt.com/phpinfo.php</a></p>
  
  <p>I hope to find the solution...</p>
  
  <p>Thank you in advance</p>