當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Facebook::Post方法代碼示例

本文整理匯總了PHP中Facebook::Post方法的典型用法代碼示例。如果您正苦於以下問題:PHP Facebook::Post方法的具體用法?PHP Facebook::Post怎麽用?PHP Facebook::Post使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Facebook的用法示例。


在下文中一共展示了Facebook::Post方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: urlencode

        }
        if (Input::Get("name")) {
            $params[] = "name=" . urlencode($spintax->get(Input::Get("name")));
        }
        if (Input::Get("caption")) {
            $params[] = "caption=" . urlencode($spintax->get(Input::Get("caption")));
        }
        if (Input::Get("description")) {
            $params[] = "description=" . urlencode($spintax->get(Input::Get("description")));
        }
    } else {
        if (Input::Get("postType") == "image") {
            $params[] = "url=" . $spintax->get(Input::Get("image"));
        } else {
            if (Input::Get("postType") == "video") {
                $params[] = "file_url=" . $spintax->get(Input::Get("file_url"));
                if (Input::Get("message")) {
                    $params[] = "title=" . urlencode($spintax->get(Input::Get("message")));
                }
                if (Input::Get("description")) {
                    $params[] = "description=" . urlencode($spintax->get(Input::Get("description")));
                }
            }
        }
    }
    if ($result = $fb->Post(Input::get("groupID"), $params, Input::Get("postType"))) {
        echo json_encode($result, 128);
    }
} else {
    echo json_encode(array('error' => lang('EMPTY_REQUEST')), 128);
}
開發者ID:andersoonluan,項目名稱:PHP,代碼行數:31,代碼來源:post.php

示例2: urlencode

     $params[] = "url=" . urlencode($spintax->get($postParam->image));
 }
 if ($postType == "video") {
     $params[] = "file_url=" . urlencode($spintax->get($postParam->video));
     if ($postParam->description != "") {
         $params[] = "description=" . urlencode($spintax->get($postParam->description));
     }
 }
 // Get app accessToken
 $accessToken = $fb->getAccessToken($scheduled->post_app, $scheduled->fb_account, $scheduled->userid);
 // Test access token
 if (!$fb->IsATValid($accessToken)) {
     logs::Save($scheduled->id, lang('INVALID_ACCESS_TOKEN'));
 } else {
     // Send post and get the result
     $result = (object) $fb->Post($groups[$scheduled->next_target], $params, $postType, $accessToken);
     // Save log
     if (isset($result->status)) {
         if (isset($result->id)) {
             logs::Save($scheduled->id, "<a href='https://www.facebook.com/" . $result->id . "' target='_blank'><span class='glyphicon glyphicon-ok'></span> " . lang('VIEW_POST') . " </a>");
         } else {
             if ($groups[$scheduled->next_target] == "me") {
                 logs::Save($scheduled->id, "Your timeline - " . $result->message);
             } else {
                 logs::Save($scheduled->id, $result->message . " <a href='https://www.facebook.com/groups/" . $groups[$scheduled->next_target] . "' target='_blank'><span class='glyphicon glyphicon-eye-open'></span> " . lang('VISIT_GROUP') . " </a>");
             }
         }
     } else {
         logs::Save($scheduled->id, lang('UNKNOWN_ERROR'));
     }
 }
開發者ID:andersoonluan,項目名稱:PHP,代碼行數:31,代碼來源:scheduledposts.php


注:本文中的Facebook::Post方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。