title: Getting data from url using PHP
body: <p>I am trying to search wikipedia and get the results in php. It works when I enter the url as a hard coded string in the php file but if I try to get the url as an argument it returns this: </p>
  
  <pre><code>["",[],[],[]]
  </code></pre>
  
  <p>Here is the code with the hard coded string:</p>
  
  <pre><code>&lt;?php
  $opts = array('http' =&gt;
    array(
      'user_agent' =&gt; 'User1 (http://www.exampe.com/)'
    )
  );
  $context = stream_context_create($opts);
  $url = 'http://en.wikipedia.org/w/api.php?action=opensearch&amp;search=yolo';
  echo file_get_contents($url, FALSE, $context);
  ?&gt;
  </code></pre>
  
  <p>Here is the version that takes an argument from its url:</p>
  
  <pre><code>&lt;?php
  $opts = array('http' =&gt;
    array(
      'user_agent' =&gt; 'User1 (http://www.exampe.com/)'
    )
  );
  $context = stream_context_create($opts);
  $url = $_GET['url'];
  echo file_get_contents($url, FALSE, $context);
  ?&gt;
  </code></pre>
  
  <p>This is how I input arguments:</p>
  
  <pre><code>http://example.com/test.php?url=http://en.wikipedia.org/w/api.php?action=opensearch&amp;search=yolo
  </code></pre>