Plugin Directory

Changeset 158647


Ignore:
Timestamp:
09/28/2009 05:09:11 PM (17 years ago)
Author:
sakuratan
Message:

Using cURL options for following location HTTP header.
Checking XML error for API result.
Version 0.9.2.5.

Location:
nitwpress/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • nitwpress/trunk/nitwpress.php

    r158624 r158647  
    66Author: sakuratan
    77Author URI: http://sakuratan.biz/
    8 Version: 0.9.2.4
     8Version: 0.9.2.5
    99*/
    1010
  • nitwpress/trunk/readme.txt

    r158608 r158647  
    55Requires at least: 2.7.0
    66Tested up to: 2.8.4
    7 Stable tag: 0.9.2.4
     7Stable tag: 0.9.2.5
    88
    99A Twitter client widget.
     
    2222
    2323== Changelog ==
     24
     25= 0.9.2.5 =
     26* Using cURL options for following location HTTP header.
     27* Checking XML error for API result.
    2428
    2529= 0.9.2.4 =
  • nitwpress/trunk/twitter.php

    r158607 r158647  
    7373    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    7474    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
     75    curl_setopt($ch, CURLOPT_AUTOREFERER, true);
     76    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
     77    curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
    7578    curl_setopt($ch, CURLOPT_URL,
    7679        'http://twitter.com/statuses/user_timeline.xml');
    7780    curl_setopt($ch, CURLOPT_USERPWD, "{$options['username']}:{$options['password']}");
    7881    $ctx = curl_exec($ch);
     82    if (!$ctx) {
     83    curl_close($ch);
     84    return false;
     85    }
    7986    $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    8087    curl_close($ch);
    81     if (!$ctx)
    82     return false;
    8388    if ($code != 200) {
    8489    trigger_error("Twitter api returns error with {$code}",
     
    8691    return false;
    8792    }
    88 
     93    if (!preg_match('/^<\?xml/', $ctx)) {
     94    trigger_error("Got none XML results", E_USER_WARNING);
     95    return false;
     96    }
    8997
    9098    // Strip and save result XML
Note: See TracChangeset for help on using the changeset viewer.