I need to perform a get request and send headers along with it. What can I use to do this?
The main header I need to set is the browser one. Is there an easy way to do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you’re using cURL, you can use
curl_setopt ($handle, CURLOPT_USERAGENT, 'browser description')to define the user-agent header of the request.If you’re using
file_get_contents, check out this tweak of an example on the man page for file_get_contents: