r/programmingrequests • u/FlandersFlannigan • Apr 21 '17
HTTP Header Request Help
Hello,
I'm somewhat new to all of this, so apologies if this is ignorant, but I can't find the answer to my question anywhere. I have been trying desperately to change the HTTP Request headers of my php request using Guzzle and curl.
I've had no luck at all. I've tried many, many methods. Some of which I feel should have worked. I'm starting to think there's a piece of this puzzle that I just don't know. What I think is happening is this:
I'm outputting the results of getallheaders() -PHP- into the browser to see what my request headers are. They always come back the same thing.
I've tried using getallheaders() to output to the console, but it doesn't work. I think because it's an extension of apache, it will only work in the browser?
I also think the reason I can't change the request header is because Chrome is setting their own request header and if I were to do this solely through the console, I wouldn't run into this issue. Is this correct?
1
u/FlandersFlannigan Apr 22 '17
This is where I get so confused. I tried the first code (getallheaders()) and output it in the browser and the user-agent shows my actual settings - even though I have included my own headers, including user-agent. However, when I make the request in the console (via guzzle) the debugger shows the http request with the headers that I set up. Same code.
What am I missing? What is the server actually seeing? I plan to do some web scraping so I I'm trying to understand what the servers will actually be seeing.