how to set user agent for get_headers PHP function

Farhad picture Farhad · Dec 6, 2011 · Viewed 9.1k times · Source

I know It's easy to set user agent for curl but my code is based on get_headers, by default get_headers user agent is empty. thanks for any help.

Answer

ioseb picture ioseb · Dec 6, 2011

Maybe this?

ini_set('user_agent', 'Mozilla/5.0');