Use Node.js and Facebook Graph API to build this "annonymous to facebook" system.
Node.js
Facebook Graph API
-
create mysql database must same as DB in kaobei.js.
-
create mysql datatable to record post must same as FanPageEnglishName in kaobei.js:
id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY dataId TEXT NOT NULL ip TEXT NOT NULL postId TEXT NOT NULL postTime TEXT NOT NULL
-
create mysql datatable to record report must same as ReportDT in kaobei.js:
id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY dataId TEXT NOT NULL ip TEXT NOT NULL fbUserId TEXT NOT NULL reportTime TEXT NOT NULL
-
Edit these three files
kaobei.js about-this-site.js functions.js 內的 shorturl
-
Install canvas
https://github.com/Automattic/node-canvas
-
Enter this project
-
npm install
-
forever start bin/www
Post only message to facebook.
Method: POST
URL: /{fanpageid}/feed
Body: {
message: 訊息,
link: 預覽網址
}
Post photo to facebook.
Method: POST
URL: /{fanpageid}/photos
Body: {
message: 訊息,
url: 圖片網址
}
Use bitly API to get short url from long url.
Method: GET
URL: http://api.bit.ly/v3/shorten?longUrl={1}&login={2}&apikey={3}&format=json";
//1: 長網址
//2: bitly使用者名稱
//3: bitly API Key
Response: {
data: {
url: 短網址
...
}
...
}