Simulating timeout is not working
I am trying to simulate a timeout response when using wp_remote_get()
for better debugging. This is the code I'm using:
set_time_limit( -0 );
ini_set('max_execution_time', 0);
$args = array(
'headers' = array(
'Content-Type' = 'application/json',
'timeout' = 15,
),
);
$request_response = wp_remote_get( $this-token_url . 'sleep=10', $args );
This is the response (WP_Error):
cURL error 28: Operation timed out after 5000 milliseconds with 0 bytes received
- It doesn't matter if I change the value of
set_time_limit
- It doesn't matter if I change the value of
max_execution_time
- It doesn't matter if I change the value of
timeout
(to 50 for example)
I still receive the cURL error after 5 seconds. Any idea why this is happening and how to solve it?
Thanks
Topic wp-remote-get curl plugin-development Wordpress
Category Web