I currently have the following snippet of php to fetch some HTML and render it in my theme(squash theme).
<?php $response = wp_remote_get( 'http://www.toucan-it.co.uk/wp-content/themes/squash/index5.html' );
print $response ['body']; ?>
The file I’m trying to request is available at the following URL.
http://www.toucan-it.co.uk/wp-content/themes/squash/index5.html
Problem
The problem is when trying to retrieve âindex5.htmlâ via the web browser the output of the file is generated but when calling it via âwp_remote_getâ using either absolute or relative paths an error is displayed.
When doing a var_dump of $response
The output can be seen on the homepage, beneath the sliders on the home page. You can see what should be rendered by the php file under the error code by looking at the Circles below (http://www.toucan-it.co.uk)
object(WP_Error)#337 (2) { ["errors"]=> array(1) { ["http_request_failed"]=> array(1) { [0]=> string(24) "couldn't connect to host" } } ["error_data"]=> array(0) { } }
Try to increase the timeout (default is 5).