title: Spaces appear after file_get_contents from HTML file
body: <p>I have 2 files: script.html and index.php. </p>
  
  <p><em>My purpose</em> is to generate a text (in this case the country of the user) in an HTML file by a JavaScript. This is the code of this HTML file:</p>
  
  <blockquote>
    <p><em>script.html</em></p>
  </blockquote>
  
  <pre><code>&lt;script language="Javascript" src="http://www.codehelper.io/api/ips/?js"&gt;&lt;/script&gt;
  &lt;script language="Javascript"&gt;document.write(codehelper_ip.Country);&lt;/script&gt;
  </code></pre>
  
  <p>And now, <em>I want to</em> take that text to the PHP file to use it as a variable:</p>
  
  <blockquote>
    <p><em>index.php</em></p>
  </blockquote>
  
  <pre><code>&lt;?php
  $content = file_get_contents(script.html);
  echo "http://www.example.com/$content/example"
  ?&gt;
  </code></pre>
  
  <p><em>The problem</em> is that the output from that <em>echo</em> is odd:</p>
  
  <blockquote>
    <p>echo output:</p>
  </blockquote>
  
  <pre><code>http://www.example.com/ US /example
  </code></pre>
  
  <p>Notice <strong>the spaces before and after the "US"</strong>. This destroys the whole purpose of the code, of course. I can't have that URL like that.</p>
  
  <p>Any way I can <strong>avoid or remove those spaces?</strong></p>
  
  <p>Why is this happening?</p>
  
  <p><em>My guess</em>: These spaces are being inserted because of the linebreaks of the JavaScript code. If I don't put any linebreak between one <code>&lt;script&gt;&lt;/script&gt;</code> and the other <code>&lt;script&gt;&lt;/script&gt;</code> (such as <code>&lt;script language="Javascript" src="http://www.codehelper.io/api/ips/?js"&gt;&lt;/script&gt;&lt;script language="Javascript"&gt;document.write(codehelper_ip.Country);&lt;/script&gt;</code>, all in one line) then I get <code>http://www.example.com/US /example</code>. I don't know how I could avoid the space after, though.</p>
  
  <p><em>Note1:</em> I have already tried <strong>trim()</strong> (I use PHP 5+ so it should work). I also tried changing the file extension ".html" to ".php" just in case it would do something, but it doesn't.</p>
  
  <p><em>Note2:</em> Even though I know I could do it some other way, I want to get the country of the user through JavaScript and not through PHP. The reason is that I can't do it via server using my current hosting plan, so I thought of JavaScript instead.</p>
  
  <p>Thank you very much.</p>