Created
March 28, 2023 20:40
-
-
Save pjaudiomv/f507b7b36ef5d835b579e58ec03fd16c to your computer and use it in GitHub Desktop.
test-bmlt-auth.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$root_server = "https://bmlt.wszf.org/main_server"; | |
$bmlt_login_id = ""; | |
$bmlt_login_password = ""; | |
$login_string = "$root_server/local_server/server_admin/json.php?c_comdef_admin_login=$bmlt_login_id&c_comdef_admin_password=$bmlt_login_password&admin_action=login"; | |
$login = get($login_string); | |
echo $login . "\n"; | |
$get_perms = get("$root_server/local_server/server_admin/json.php?admin_action=get_permissions"); | |
echo $get_perms . "\n"; | |
function get($url) | |
{ | |
error_log($url); | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie_monster.txt'); | |
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie_monster.txt'); | |
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:108.0) Gecko/20100101 Firefox/108.0'); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLINFO_HEADER_OUT, true); | |
$data = curl_exec($ch); | |
$info = curl_getinfo($ch); | |
print_r($info['request_header']); | |
$errorno = curl_errno($ch); | |
curl_close($ch); | |
if ($errorno > 0) { | |
echo $errorno; | |
throw new Exception(curl_strerror($errorno)); | |
} | |
return $data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment