Gets URL.
Parameters
$url
stringrequired$username
stringoptionalDefault:
''
$password
stringoptionalDefault:
''
$head
booloptionalDefault:
false
Source
public function get_page( $url, $username = '', $password = '', $head = false ) {
// Increase the timeout.
add_filter( 'http_request_timeout', array( $this, 'bump_request_timeout' ) );
$headers = array();
$args = array();
if ( true === $head ) {
$args['method'] = 'HEAD';
}
if ( ! empty( $username ) && ! empty( $password ) ) {
$headers['Authorization'] = 'Basic ' . base64_encode( "$username:$password" );
}
$args['headers'] = $headers;
return wp_safe_remote_request( $url, $args );
}
User Contributed Notes
You must log in before being able to contribute a note or feedback.