30 行
935 B
PHP
30 行
935 B
PHP
<?php
|
|
require_once("config.php");
|
|
$gurl = str_replace("/?id=", "", htmlspecialchars($_SERVER["REQUEST_URI"]));
|
|
$psize = 18;
|
|
$rpsize = $psize * 2;
|
|
$mrpsize = 161;
|
|
|
|
function get (string $url = "", bool $prx = false, bool $embed = false): stdClass {
|
|
$res = [];
|
|
$ch = curl_init();
|
|
if ($prx) curl_setopt($ch, CURLOPT_URL, "https://".$url);
|
|
else curl_setopt($ch, CURLOPT_URL, ($prx ? $url : "https://".($embed ? "embed.pixiv.net" : "www.pixiv.net/ajax")."/".$url));
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
|
"Cookie: PHPSESSID=".SESSION_ID,
|
|
"User-Agent: Mozilla/5.0",
|
|
]);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
$res = mb_convert_encoding(curl_exec($ch), "UTF-8", "EUC-JP");
|
|
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
|
curl_close($ch);
|
|
|
|
if (!$res || $httpCode != 200) {
|
|
echo "エラー ".$httpCode;
|
|
die();
|
|
}
|
|
|
|
return json_decode($res);
|
|
}
|
|
?>
|