Make WordPress Core


Ignore:
Timestamp:
10/02/2008 12:32:21 AM (17 years ago)
Author:
ryan
Message:

Error checking for HTTP requests. Props jacobsantos. see #7793

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r9025 r9051  
    10401040    $response = wp_remote_request($url, $options);
    10411041
     1042    if ( is_wp_error( $response ) )
     1043        return false;
     1044
    10421045    $headers = wp_remote_retrieve_headers( $response );
    10431046    if ( false == $file_path )
     
    10731076function wp_get_http_headers( $url, $deprecated = false ) {
    10741077    $response = wp_remote_head( $url );
     1078
     1079    if ( is_wp_error( $response ) )
     1080        return false;
     1081
    10751082    return wp_remote_retrieve_headers( $response );
    10761083}
     
    12411248 *
    12421249 * @param string $uri URI/URL of web page to retrieve.
    1243  * @return string HTTP content.
     1250 * @return bool|string HTTP content. False on failure.
    12441251 */
    12451252function wp_remote_fopen( $uri ) {
    1246     // parse url() should not be used for validation of URLs.
    1247     // Keeping anyway, since the Filter extension is not available on all servers.
    12481253    $parsed_url = @parse_url( $uri );
    12491254
     
    12551260
    12561261    $response = wp_remote_get( $uri, $options );
     1262
     1263    if ( is_wp_error( $response ) )
     1264        return false;
    12571265
    12581266    return $response['body'];
Note: See TracChangeset for help on using the changeset viewer.