Make WordPress Core

Changeset 9142


Ignore:
Timestamp:
10/13/2008 11:41:03 PM (16 years ago)
Author:
ryan
Message:

Convert download_url() to http api. Props DD32. see #7793

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/file.php

    r9053 r9142  
    435435        return new WP_Error('http_no_file', __('Could not create Temporary file'));
    436436
    437     require_once( ABSPATH . 'wp-includes/class-snoopy.php' );
    438     $snoopy = new Snoopy();
    439     $snoopy->fetch($url);
    440 
    441     if( $snoopy->status != '200' ){
     437    $response = wp_remote_get($url);
     438
     439    if( $response['response']['code'] != '200' ){
    442440        fclose($handle);
    443441        unlink($tmpfname);
    444         return new WP_Error('http_404', trim($snoopy->response_code));
    445     }
    446     fwrite($handle, $snoopy->results);
     442        return new WP_Error('http_404', trim($response['response']['message']));
     443    }
     444    fwrite($handle, $response['body']);
    447445    fclose($handle);
    448446
Note: See TracChangeset for help on using the changeset viewer.