Example #1
0
function RequsetData($gender)
{
    $sql = "SELECT `message`, `obj_id`, `created_time` FROM  `beauty_nttu`  WHERE `message` LIKE '%【" . $gender . "】%'";
    $conn = new ConnectDB();
    $link = $conn->InitialDB();
    $data = $conn->ProcessData($link, $sql, array(), "get-image-id");
    $conn->ConnectClose($link);
    $str = '<h2>資料來源:<a href="https://www.facebook.com/BeautyNTTU/?fref=ts" target="_blank">表特東大</a></h2>
				<p>僅提供瀏覽,欣賞</p>';
    $len = count($data);
    for ($index = 0; $index < $len; $index++) {
        $message = $data[$index]["message"];
        $normal = "https://graph.facebook.com/" . $data[$index]["obj_id"] . "/picture?type=normal";
        $thumbnail = "https://graph.facebook.com/" . $data[$index]["obj_id"] . "/picture?type=thumbnail";
        $str .= '<a title="' . $message . '" class="swipebox" href="' . $normal . '">';
        $str .= '<img src="' . $thumbnail . '" alt="image" class="img-rounded">';
        $str .= '</a>';
    }
    return $str;
}
Example #2
0
$dir = "/";
foreach ($dirs as $value) {
    if ($value === "script") {
        continue;
    }
    if (strlen($value) !== 0) {
        $dir .= $value . "/";
    }
}
require $dir . "vendor/autoload.php";
require "ConnectDB.php";
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
$client = new Client();
$connection = new ConnectDB();
$conn = $connection->InitialDB();
$AppToken = "";
$handle = @fopen($dir . "script" . "/token/tokens.txt", "r");
if (!$handle) {
    echo "the token file is not existed.";
    exit;
} else {
    while (!feof($handle)) {
        $temp = fgets($handle, 4096);
        if ($temp != "") {
            $AppToken = $temp;
        }
    }
    fclose($handle);
}
$contents = array();