WPSEO_MyYoast_Proxy::get_remote_url_body
Tries to load the given url via wp_remote_get.
Метод класса: WPSEO_MyYoast_Proxy{}
Хуков нет.
Возвращает
Строку. The body of the response.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_remote_url_body( $url );
- $url(строка) (обязательный)
- The url to load.
Код WPSEO_MyYoast_Proxy::get_remote_url_body() WPSEO MyYoast Proxy::get remote url body Yoast 26.3
protected function get_remote_url_body( $url ) {
$response = wp_remote_get( $url );
if ( $response instanceof WP_Error ) {
throw new Exception( 'Unable to retrieve file from MyYoast' );
}
if ( wp_remote_retrieve_response_code( $response ) !== 200 ) {
throw new Exception( 'Received unexpected response from MyYoast' );
}
return wp_remote_retrieve_body( $response );
}