title: URL encode string the way google does in Chrome
body: <p>I have an URL which I need to CURL in PHP:</p>
  
  <pre><code>http://query.yahooapis.com/v1/public/yql?q= select * from yahoo.finance.historicaldata where symbol = "LINE" and startDate = "2015-09-23" and endDate  = "2015-09-25" &amp;format=xml &amp;env=store://datatables.org/alltableswithkeys
  </code></pre>
  
  <p>When I use the URL "as is" I get nothing, no data, blank page.</p>
  
  <p>When I enter the URL in the address bar of Chrome I get some encoding and the URL looks like this:</p>
  
  <pre><code>http://query.yahooapis.com/v1/public/yql?q=%20select%20*%20from%20yahoo.finance.historicaldata%20where%20symbol%20=%20%22LINE%22%20and%20startDate%20=%20%222015-09-23%22%20and%20endDate%20=%20%222015-09-25%22%20&amp;format=xml%20&amp;env=store://datatables.org/alltableswithkeys
  </code></pre>
  
  <p>Now when I CURL this URL above it works, I get data. 
  The problem is that I need to do this programmatic instead of copy/paste. So I used <code>rawurlencode</code> and <code>urlencode</code> But they don't transform the URL like above and I get a blank page once again.</p>
  
  <p>What type of encoding (preferably PHP but javascript is also good) should I use to transform the URL like Google Chrome does?    </p>