mirror of
https://github.com/sigmasternchen/mobmash.click
synced 2025-03-15 08:09:02 +00:00
feat: Add custom user agent for API requests
This commit is contained in:
parent
6f46f9851e
commit
1f00915f81
4 changed files with 13 additions and 4 deletions
|
@ -4,4 +4,7 @@ const POSTGRES_HOST = "%DBHOST%";
|
|||
const POSTGRES_PORT = 5432;
|
||||
const POSTGRES_DBNAME = "%DBNAME%";
|
||||
const POSTGRES_USER = "%DBUSER%";
|
||||
const POSTGRES_PASSWORD = "%DBPASSWORD%";
|
||||
const POSTGRES_PASSWORD = "%DBPASSWORD%";
|
||||
|
||||
|
||||
const CONTACT_EMAIL = "%EMAIL%";
|
4
core.php
4
core.php
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
require_once __DIR__ . '/lib/migrate.php';
|
||||
require_once __DIR__ . "/version.php";
|
||||
|
||||
require_once __DIR__ . "/lib/migrate.php";
|
||||
|
||||
migrate();
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
require_once __DIR__ . "/../credentials.php";
|
||||
require_once __DIR__ . "/../config.php";
|
||||
|
||||
$dsn = "pgsql:host=" . POSTGRES_HOST . ";dbname=" . POSTGRES_DBNAME . ";port=" . POSTGRES_PORT;
|
||||
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
<?php
|
||||
|
||||
require_once __DIR__ . "/../config.php";
|
||||
|
||||
const USER_AGENT = "MobMash Updater/" . VERSION . " (+https://github.com/overflowerror/mobmash.click; contact: " . CONTACT_EMAIL . ")";
|
||||
|
||||
function get(string $url): string {
|
||||
$curl = curl_init($url);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36');
|
||||
curl_setopt($curl, CURLOPT_USERAGENT, USER_AGENT);
|
||||
$response = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
return $response;
|
||||
|
|
Loading…
Reference in a new issue