Changeset 1676

Show
Ignore:
Timestamp:
10/12/05 03:43:37
Author:
miyagawa
Message:

API error handling

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • SpamSubmission/trunk/SpamSubmission.pl

    r1675 r1676  
    6767    $ua->timeout(5); 
    6868 
    69     my $res = $ua->post("http://bulkfeeds.net/app/submit_spam", { 
     69    my $res = $ua->post("http://bulkfeeds.net/app/submit_spam.xml", { 
    7070        url => join("\n", @$urls_ref), 
    7171        %apikeys, 
    7272    }); 
     73 
     74    if ($res->is_success) { 
     75        my $xml = $res->content; 
     76        if ($xml =~ m!<error>(.*)</error>!) { 
     77            MT::log("error: $1"); 
     78        } else { 
     79            MT::log("success"); 
     80        } 
     81    } else { 
     82        MT::log("Submit API failure: " . $res->code); 
     83    } 
    7384} 
    7485