Changeset 9553 for trunk/wp-includes/rss.php
- Timestamp:
- 11/06/2008 07:06:43 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/rss.php
r9243 r9553 385 385 386 386 } 387 require_once( dirname(__FILE__) . '/class-snoopy.php');388 387 389 388 if ( !function_exists('fetch_rss') ) : … … 527 526 528 527 /** 529 * Retrieve URL headers and content using Snoopy.528 * Retrieve URL headers and content using WP HTTP Request API. 530 529 * 531 530 * @since unknown … … 535 534 * @param string $url URL to retrieve 536 535 * @param array $headers Optional. Headers to send to the URL. 537 * @return Snoopy 536 * @return Snoopy style response 538 537 */ 539 538 function _fetch_remote_file ($url, $headers = "" ) { 540 // Snoopy is an HTTP client in PHP 541 $client = new Snoopy(); 542 $client->agent = apply_filters( 'magpie_user_agent', MAGPIE_USER_AGENT ); 543 $client->read_timeout = MAGPIE_FETCH_TIME_OUT; 544 $client->use_gzip = MAGPIE_USE_GZIP; 545 if (is_array($headers) ) { 546 $client->rawheaders = $headers; 547 } 548 549 @$client->fetch($url); 550 return $client; 551 539 $resp = wp_remote_request($url, array('headers' => $headers, 'timeout' => MAGPIE_FETCH_TIME_OUT)); 540 if ( is_wp_error($resp) ) { 541 $resp = new stdClass; 542 $resp->status = 500; 543 return $resp; 544 } 545 $response->status = $resp['response']['code']; 546 $response->headers = $resp['headers']; 547 $response->results = $resp['body']; 548 549 return $response; 552 550 } 553 551
Note: See TracChangeset
for help on using the changeset viewer.