function errTest($result_struct)
 {
     // Check the results for an error
     if (!$result_struct->faultCode()) {
         // Get the results in a value-array
         $values = $result_struct->value();
         // Compile results into PHP array
         $result_array = lib_xmlrpc_decode($values);
         // Check the result for error strings.
         $valid = blogger_checkFaultString($result_array);
         // Return something based on the check
         if ($valid == true) {
             $r = $result_array;
         } else {
             $r = $valid;
         }
     } else {
         $r = $result_struct->faultString();
     }
     return $r;
 }
示例#2
0
function blogger_editPost($postid, $username, $password, $publish = false, $string)
{
    global $BLOGGER_APPID;
    // Convert common synonyms for true so that we have a proper boolean
    if ($publish == "true" || $publish == "1" || $publish == "yes") {
        $publish = true;
    }
    // Connect to blogger server
    if (!($blogClient = blogger_connectToBlogger())) {
        return false;
        exit;
    }
    // Create the variables that form the request
    $XMLappid = new xmlrpcval($BLOGGER_APPID, "string");
    $XMLpostid = new xmlrpcval($postid, "string");
    $XMLusername = new xmlrpcval($username, "string");
    $XMLpassword = new xmlrpcval($password, "string");
    $XMLpublish = new xmlrpcval($publish, "boolean");
    $XMLstring = new xmlrpcval($string, "boolean");
    // Construct the actual request message
    $editPostRequest = new xmlrpcmsg("blogger.editPost", array($XMLappid, $XMLpostid, $XMLusername, $XMLpassword, $XMLstring, $XMLpublish));
    // Now send the request
    $result_struct = $blogClient->send($editPostRequest);
    // Check the results for an error
    if (!$result_struct->faultCode()) {
        // Get the results in a value-array
        $values = $result_struct->value();
        // Compile results into PHP array
        $result = xmlrpc_decode($values);
        // Return something based on the check
        if (is_array($result)) {
            return blogger_checkFaultString($result);
        } else {
            return $result;
        }
    } else {
        return $result_struct->faultString();
    }
}