title: How to Send Headers Through PHP Proxy?
body: <p>Okay, so I have an issue with an AJAX request. I currently have this URL:</p>
  
  <p><a href="http://www.google.com/images?hl=en&amp;safe=off&amp;gbv=2&amp;tbs=isch%3A1&amp;sa=1&amp;q=cars+imagesize%3A500x500&amp;aq=f&amp;aqi=&amp;aql=&amp;oq=&amp;gs_rfai=&amp;start=0" rel="nofollow noreferrer">http://www.google.com/images?hl=en&amp;safe=off&amp;gbv=2&amp;tbs=isch%3A1&amp;sa=1&amp;q=cars+imagesize%3A500x500&amp;aq=f&amp;aqi=&amp;aql=&amp;oq=&amp;gs_rfai=&amp;start=0</a></p>
  
  <p>I then pass it to my proxy script by modifying the string to this:</p>
  
  <p>proxy.php?url=<a href="http://www.google.com/images?hl=en&amp;safe=off&amp;gbv=2&amp;tbs=isch%3A1&amp;sa=1&amp;q=cars+imagesize%3A500x500&amp;aq=f&amp;aqi=&amp;aql=&amp;oq=&amp;gs_rfai=&amp;start=0" rel="nofollow noreferrer">http://www.google.com/images?hl=en&amp;safe=off&amp;gbv=2&amp;tbs=isch%3A1&amp;sa=1&amp;q=cars+imagesize%3A500x500&amp;aq=f&amp;aqi=&amp;aql=&amp;oq=&amp;gs_rfai=&amp;start=0</a></p>
  
  <p>I need to use the PHP proxy script to grab that page's HTML so that I can then parse through it with javascript. However, the problem is that the headers in that URL are also being sent to the proxy script, and as a result, I get a 'malformed or illegal request' error. I'm pretty sure the two different sets of headers are the problem, because if I just replace the original URL string with '<a href="http://wwww.google.com" rel="nofollow noreferrer">http://wwww.google.com</a>', the proxy returns the HTML of the page correctly.</p>
  
  <p>So basically, I don't know how to fix this. I'm a complete PHP noob, and I tried escaping the original URL before I appended it to the 'proxy.php?url=', but that doesn't fix  anything. Any ideas?</p>
  
  <p>Thanks!</p>