Random user agents for WordPress Remote Requests

wordpress remote requests

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

Continue reading “Random user agents for WordPress Remote Requests”