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 perform the WP REST call, but it was enough to perform the dummy call. Generally, in terms of doing an HTTP request 5 seconds should be enough in most cases. But it seems in your WP REST endpoint you are doing too much work that need more than 5 seconds.
You can increase the timeout value to any value (15 seconds for example) by the following filter.
function custom_http_request_timeout( ) {
return 15;
}
add_filter( 'http_request_timeout', 'custom_http_request_timeout' );
Related Posts:
- wp_remote_get vs. file_get_contents vs. cURL?
- How to convert this cURL to wp_remote_*?
- Is there a way to follow redirects with command line cURL?
- How to send a header using a HTTP request through a cURL call?
- How can I set the request header for curl?
- How to display request headers with command line curl
- How to fix libeay32.dll was not found error
- cURL to show response headers after submiting a file
- wget/curl large file from google drive
- curl: (35) SSL connect error
- How do I make curl ignore the proxy?
- SSL CA cert (path? access rights?)
- How do I measure request and response times at once using cURL?
- cURL equivalent in Node.js?
- Curl Error 56 “Failure when receiving data from the peer” while sending .tar.gz File
- Run Rsync from Python [duplicate]
- HTTP request on localhost failing
- Use wp_remote_get to get JSON instagram feed from public profile
- cURL – How to send and fetch data in WordPress
- On Plugin Activation, How Do I Check for Proper Transport Mechanism?
- cURL RETURNTRANSFER function in wp_remote_post
- How to send file by wp_remote_post?
- Download file using cURL into wp-includes/uploads
- calling admin-ajax.php from admin-ajax.php
- cURL request to plugin repository fails 403
- Simulating timeout is not working
- Curl error while creating user
- Call external API in wordpress based on user input
- Inconsistencies between wp_remote_post and cURL
- Set wordpress auth cookie from external site?
- Does wp_remote_post() require curl?
- How to use the HTTP API (wp_remote_get) instead of cURL?
- Difference between `curl -I` and `curl -X HEAD`
- wp_remote_post vs curl to send data in WordPress plugin
- How do I get a YouTube video thumbnail from the YouTube API?
- What’s the net::ERR_HTTP2_PROTOCOL_ERROR about?
- How do I POST JSON data with cURL?
- How to fix “SSL certificate problem: self signed certificate in certificate chain” error?
- How to define the basic HTTP authentication using cURL correctly?
- performing HTTP requests with cURL (using PROXY)
- How to do a PUT request with cURL?
- Using cURL with a username and password?
- PHP + curl, HTTP POST sample code?
- Can curl make a connection to any TCP ports, not just HTTP/HTTPS?
- How do I get a YouTube video thumbnail from the YouTube API?
- How do I POST JSON data with cURL?
- curl : (1) Protocol https not supported or disabled in libcurl
- Curl : connection refused
- file_get_contents( ) not working
- Can PHP cURL retrieve response headers AND body in a single request?
- How to POST JSON Data With PHP cURL?
- curl: (60) Peer’s Certificate issuer is not recognized.
- How to use OAuth authentication with REST API via CURL commands?
- I found this in a plugin. What does it do? is it dangerous?
- Uploading media with the REST API
- wp_remote_get(), downloading and saving files
- How to add Request header in WordPress remote api calls
- HTTP digest authentication using wp_remote_get
- rewrite script to use wp_remote_get instead of file_get_contents_curl
- How can I use CURLOPT_USERPWD in wp_remote_post?
- Build dynamic page from cURL (HTML page) response with plugin
- wp_remote_get keeps timing out
- Login WordPress website using wp-rest api
- Remove caching from wp_remote_get calls from custom plugin
- Most performant way of fetching remote API data?
- How to Download and install plugin database remotely
- wp_remote_get adding backslashes
- Cannot parse results from wp_remote_get
- XML-code sent via the POST method to the URL (API) [closed]
- How can i get the post’s full html source by its ID?
- How to create a WP Cron hooks based on schedules from Advanced cron manager plugin?
- Strange Situation When Try To Retrieve Github Gist Using wp_remote_get
- WP OAuth Server “The grant type was not specified in the request”
- Why is json_decode failing?
- Passing cookies when using wp_remote_get
- AJAX error handling for submit function in functions file
- How to send a HTTP Post request using PHP Curl and WordPress
- How to rewrite this file_get_contents() snippet using wp_remote_get()
- SOAP Request/Parsing XML From wp_send_json_success
- cURL error 6 on news area, and also won’t auto update
- Post to WordPress from another Server via PHP
- Accessing an API with jQuery and AJAX
- AJAX request not routing through proxy
- CURL error with REST API
- Getting Download failed. cURL error 28: Connection timed out after 10001 milliseconds
- Use wp_remote_get() with a private or password protected page?
- How to import the data to the post from an external URL?
- Install plugin on remote wordpress
- Post to WordPress API using cURL and login cookies
- add pagination to wp_remote_get
- How to send user data from one website to another
- GET web api method from a WordPress PHP script
- wordpress database error
- Does WordPress perform better with curl installed?
- Is it possible to load an admin page inside a thickbox?
- saving file to external server vip
- wp_remote_get with Google Books API
- WordPress Plugin: Where should I put my cookies for cURL?
- rest_cannot_create_user – Sorry, you are not allowed to create new users. CURL WORDPRESS REST API
- cURL External API request displays content above other content on page