Plugin Directory

Changeset 646378


Ignore:
Timestamp:
12/31/2012 01:09:00 PM (13 years ago)
Author:
misternifty
Message:

Converted remote fetch to WP HTTP API call

File:
1 edited

Legend:

Unmodified
Added
Removed
  • debug-this/trunk/debug-this.php

    r646374 r646378  
    168168        $url = get_bloginfo('url') . '/' . $wp->request . "?$query_string";
    169169
    170         #Send auth headers for remote fetch
     170        #Set auth headers for remote fetch
    171171        $cookie_string = '';
    172172        foreach($_COOKIE as $k => $v)
    173173            $cookie_string .= $k . '=' . urlencode($v) . '; ';
    174174        $cookie_string = trim($cookie_string, '; ');
    175         $context = stream_context_create(array('http' => array('header'  => "Cookie: $cookie_string")));
    176 
    177         $buffer = file_get_contents($url, false, $context);
     175        $headers = array(
     176            'Cookie' => $cookie_string
     177        );
     178
     179        $http = new WP_Http;
     180        $response = $http->request($url, array('method' => 'GET', 'headers' => $headers));
     181        $buffer = $response['body'];
    178182
    179183        preg_match('/%DEBUG_TIME%(.+)%\/DEBUG_TIME%/', $buffer, $matches);
Note: See TracChangeset for help on using the changeset viewer.