wp_remote_get() and wp_remote_post() functions helps us to fetch data from external source: grabbing websites, getting data from public sources, API’s etc.
Sometimes using default headers causes suspect at external side. Too often requests can cause asking a captcha, or blocking your IP.
To escape from such problems we need to insert real visitor like user agents to our requests. And not only one, but randomly chosen ones.
Here is sample code for WordPress
remote_request() function will return normal array which contains $response[‘headers’] and $response[‘body’] data.
Thanks! You used “user_agent_choser” instead of “random_user_agent” in the “remote_request” function
Thank you 🙂 fixed.