How to convert this cURL to wp_remote_*?

/* ########################################################################## * * * DETERMINE ENTITY, via native wp_remote_post() call * /* ########################################################################## */ function get_entity_type_via_wp( $text_to_analyse, // passed string to be handed to GClouD NLP $entity = ‘type’ // part of each “entities” result to return ) { // Google Cloud API key $options = get_option( ‘cxt_settings’ ); $google_nlp_api = $options[‘cxt_gcloud’]; // Call … Read more

wp_remote_get – cURL error 28 – only on same domain

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

How do I measure request and response times at once using cURL?

From this brilliant blog post… https://blog.josephscott.org/2011/10/14/timing-details-with-curl/ cURL supports formatted output for the details of the request (see the cURL manpage for details, under -w, –write-out <format>). For our purposes we’ll focus just on the timing details that are provided. Times below are in seconds. Create a new file, curl-format.txt, and paste in: time_namelookup: %{time_namelookup}s\n time_connect: %{time_connect}s\n time_appconnect: %{time_appconnect}s\n time_pretransfer: … Read more