mirror of
https://ghproxy.net/https://github.com/elementor/wp2static.git
synced 2025-08-31 12:36:57 +08:00
parent
67fb00af41
commit
0e2738a96a
3 changed files with 48 additions and 24 deletions
|
@ -28,10 +28,21 @@ class StaticHtmlOutput_UrlRequest
|
|||
*/
|
||||
public function __construct($url, $cleanMeta = false)
|
||||
{
|
||||
$this->_url = filter_var($url, FILTER_VALIDATE_URL);
|
||||
$this->_url = filter_var(trim($url), FILTER_VALIDATE_URL);
|
||||
$this->_cleanMeta = $cleanMeta;
|
||||
|
||||
$response = wp_remote_get($this->_url,array('timeout'=>300)); //set a long time out
|
||||
$this->_response = (is_wp_error($response) ? '' : $response);
|
||||
|
||||
$this->_response = '';
|
||||
|
||||
if (is_wp_error($response)) {
|
||||
error_log('WP_ERROR');
|
||||
error_log(print_r($response, true));
|
||||
$this->_response = 'FAIL';
|
||||
} else {
|
||||
$this->_response = $response;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,6 +53,11 @@ class StaticHtmlOutput_UrlRequest
|
|||
{
|
||||
return $this->_url;
|
||||
}
|
||||
|
||||
public function checkResponse()
|
||||
{
|
||||
return $this->_response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows to override the HTTP response body
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue