wp_remote_get keeps timing out
Check with these args $args = array( ‘timeout’ => 10, ‘sslverify’ => false );
Check with these args $args = array( ‘timeout’ => 10, ‘sslverify’ => false );
I had to dig pretty deep for this too, and eventually figured out some way to do this. in my solution I used the following: WP_Filesystem(); global $wp_filesystem; $wp_filesystem->exists( ‘/path/to/file’ ); //use any other functions available in the Filesystem API: @see https://developer.wordpress.org/reference/classes/wp_filesystem_direct/
There is no reason for your design, but the core of your problem is that (I assume) people are trying to use a free tier of the API instead of properly paying for its use and removing the ridiculous restrictions. Anyway, the solution is fairly simple, run your cron every half an hour, allocate to … Read more
How do I execute a wp_remote_get call using NTLM authentication?
Neither are high performance, and they do different things. fetch_feed is for grabbing feeds RSS feeds etc, wp_remote_get is for grabbing arbitrary items. Neither are fast, and the performance difference between each is negligible or irrelevant, but technically fetch_feed is slower than wp_remote_get, not because it’s faster or slower at grabbing over the network, but … Read more
Try to increase the timeout (default is 5). $response = wp_remote_get( ‘http://www.toucan-it.co.uk/wp-content/themes/squash/index5.html’, array( ‘timeout’ => 120, ‘httpversion’ => ‘1.1’ ) );
While the other answers are pretty good in providing an answer to your question (how to get the generated url), i will answer what i guess you really want to know (how do i get it to call thirdparty.com?foo=bar with wp_remote_get) The Answer is: the $args array you use to transmit the url parameters won’t … Read more
The HTTP request sent by wp_remote_get() is different from the one that a browser sends. E.g the user-agent is different (see documentation). Some websites respond differently based on this. The second argument of wp_remote_get() allows one to alter the request. Websites might also respond differently depending on the IP or the number of requests received … Read more
By default, WordPress set the timeout value for cURL in wp-includes/class-wp-http-curl.php to 5 seconds and the same value is also set to HTTP requests in wp-includes/class-http.php that is a newer class for making HTTP requests that can use also cURL if it’s present in the server. In your case, 5 seconds was not enough to … Read more
Always use wp_remote_get when in a WordPress context. It figures out the correct way, be it curl or something else, and uses that. Simple.