Example #1
0
function post_check_in($place_id = "", $checkin_Message = "")
{
    $fb_access_token = $_SESSION["fb_access_token"];
    $fb_user_id = $_SESSION["facebook_userid"];
    if ($place_id && $checkin_Message && $fb_access_token && $fb_user_id) {
        $checkin_data = json_decode(curl_function("https://graph.facebook.com/" . $place_id));
        if (!isset($checkin_data->error)) {
            $Post_url = "https://graph.facebook.com/" . $fb_user_id . "/checkins";
            $post_arg = array("access_token" => $fb_access_token, "message" => $checkin_Message, "coordinates" => json_encode(array('latitude' => $checkin_data->location->latitude, 'longitude' => $checkin_data->location->longitude)), 'tags' => "", "place" => $checkin_data->id);
            $status = curl_function($Post_url, "POST", $post_arg);
        } else {
            $status = "Invalid Place id";
        }
    } else {
        $status = "somthing missing";
    }
    return $status;
}
Example #2
0
<?php

include $_SERVER["DOCUMENT_ROOT"] . '/system/modules/facebook/function.php';
/** FACEBOOK CONNECT **/
$fb_access_token = $_SESSION["fb_access_token"];
if (!$fb_access_token) {
    if ($_GET["code"]) {
        $token_url = "https://graph.facebook.com/oauth/access_token?client_id=" . $app_id . "&redirect_uri=" . urlencode($redirect_url) . "&client_secret=" . $app_secret . "&code=" . $_GET["code"];
        $access_token = curl_function($token_url);
        $FBtoken = str_replace("access_token=", "", $access_token);
        $FBtoken = explode("&expires=", $FBtoken);
        if (isset($FBtoken[0])) {
            if ($FBtoken[0]) {
                $profile_data_url = "https://graph.facebook.com/me?access_token=" . $FBtoken[0];
                $Profile_data = json_decode(curl_function($profile_data_url));
                if (isset($Profile_data->error)) {
                    echo "Problem in Facebook Connect! Try again later.";
                    exit;
                } else {
                    $id = $Profile_data->id;
                    $fname = $Profile_data->first_name;
                    $lanme = $Profile_data->last_name;
                    $email = $Profile_data->email;
                    $image = "http://graph.facebook.com/" . $id . "/picture";
                    $access_token = $FBtoken[0];
                    /** INSERT AND UPDATE DB **/
                    if ($_SESSION["userid"]) {
                        updateFBuser($_SESSION["userid"], $image, $access_token, $id, $fname, $lname, $email);
                    } else {
                        easyRegister("FB" . $id, $fname, $lanme, $email, $image, 1, $access_token, $id);
                    }
        $run = curl_exec($ch);
        curl_close($ch);
        echo "EN: Data has been send. TR: Veri gönderildi. <br/>";
    }
    $datalink = $_POST['datalink'];
    // Change SQL code to yourself according. // SQL kodunu kendinize göre değiştirin.
    $getdatadb = $db->query("SELECT * FROM posts")->fetchAll(PDO::FETCH_ASSOC);
    foreach ($getdatadb as $datas) {
        $title = $datas['title'];
        $keywords = $datas['keywords'];
        $content = $datas['content'];
        $categoryid = $datas['category'];
        $status = $datas['status'];
        $authorid = $datas['author'];
        $dataforsend = array("title" => $title, "keywords" => $keywords, "content" => $content, "category" => $categoryid, "status" => $status, "author" => $authorid);
        curl_function($datalink, $dataforsend);
    }
} else {
    ?>
    <!doctype html>
    <html lang="tr">
    <head>
        <meta charset="UTF-8">
        <title>Wordpress Remote Data Sender</title>
        <style type="text/css">
            input{
                width: 500px;
                padding: 5px;
                margin-bottom: 10px;
            }
            input[type="submit"]{