コード例 #1
0
ファイル: BlogSpot.php プロジェクト: CivicCommons/oldBellCaPA
 public function send($post, $blogurl, $username, $password)
 {
     $connection = blogger_connectToBlogger();
     $data = blogger_getUsersBlogs($username, $password);
     $blogid = usersubs_get_blog_id($data, $blogurl);
     $description = $post['body'];
     $content = $description;
     $data = blogger_newPost($blogid, $username, $password, $content, 1);
 }
コード例 #2
0
ファイル: blogger.php プロジェクト: CivicCommons/oldBellCaPA
function blogger_setTemplate($blogid, $username, $password, $template = "main", $string)
{
    global $BLOGGER_APPID;
    if (strpos($string, "<Blogger>") === false || strpos($string, "</Blogger>") === false) {
        return "Invalid template, must contain <Blogger> and </Blogger> tags.";
        exit;
    }
    // Connect to blogger server
    if (!($blogClient = blogger_connectToBlogger())) {
        return false;
        exit;
    }
    // Create the variables that form the request
    $XMLappid = new xmlrpcval($BLOGGER_APPID, "string");
    $XMLblogid = new xmlrpcval($blogid, "string");
    $XMLusername = new xmlrpcval($username, "string");
    $XMLpassword = new xmlrpcval($password, "string");
    $XMLtemplate = new xmlrpcval($template, "string");
    $XMLstring = new xmlrpcval($string, "string");
    // Construct the actual request message
    $setTemplateRequest = new xmlrpcmsg("blogger.setTemplate", array($XMLappid, $XMLblogid, $XMLusername, $XMLpassword, $XMLstring, $XMLtemplate));
    // Now send the request
    $result_struct = $blogClient->send($setTemplateRequest);
    // 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 = xmlrpc_decode($values);
        // Return something based on the check
        if (!is_array($result_array)) {
            $result_array = str_replace("&lt;", "<", $result_array);
            return $result_array;
        } else {
            return false;
        }
    } else {
        return $result_struct->faultString();
    }
}