3v4l.org

run code in 500+ PHP versions simultaneously
<?php // 接口配置 $apiKey = "c7b9a2de14b386f7a7dde163f2ecac98"; $domain = "aizhan.com"; // 拼接完整 URL $url = "https://apistore.aizhan.com/icp/checkdomain/{$apiKey}?domain=" . urlencode($domain); // 使用 file_get_contents 发起 GET 请求 $options = [ 'http' => [ 'method' => 'GET', 'header' => "User-Agent: Mozilla/5.0\r\n", 'timeout' => 30 ], 'ssl' => [ 'verify_peer' => false, 'verify_peer_name' => false ] ]; $context = stream_context_create($options); $result = file_get_contents($url, false, $context); // 检查请求是否成功 if ($result === false) { echo "请求失败,请检查网络或 URL 是否正确。\n"; echo "尝试访问的 URL: " . $url . "\n"; } else { // 解析并格式化输出 JSON $data = json_decode($result, true); if ($data) { echo "=== 解析后的结果 ===\n"; echo "状态: " . $data['status'] . "\n"; echo "返回码: " . $data['code'] . "\n"; echo "消息: " . $data['msg'] . "\n"; if (isset($data['data'])) { echo "域名: " . $data['data']['domain'] . "\n"; echo "黑名单等级: " . $data['data']['blackListLevel'] . " "; switch ($data['data']['blackListLevel']) { case 2: echo "(正常域名)\n"; break; case 0: echo "(已列入黑名单)\n"; break; case -1: echo "(状态未知)\n"; break; default: echo "\n"; } } echo "\n=== 原始 JSON ===\n"; echo $result; } else { echo "原始返回内容:\n" . $result; } } ?><?php // 接口配置 $apiKey = "c7b9a2de14b386f7a7dde163f2ecac98"; $domain = "aizhan.com"; // 拼接完整 URL $url = "https://apistore.aizhan.com/icp/checkdomain/{$apiKey}?domain=" . urlencode($domain); // 使用 file_get_contents 发起 GET 请求 $options = [ 'http' => [ 'method' => 'GET', 'header' => "User-Agent: Mozilla/5.0\r\n", 'timeout' => 30 ], 'ssl' => [ 'verify_peer' => false, 'verify_peer_name' => false ] ]; $context = stream_context_create($options); $result = file_get_contents($url, false, $context); // 检查请求是否成功 if ($result === false) { echo "请求失败,请检查网络或 URL 是否正确。\n"; echo "尝试访问的 URL: " . $url . "\n"; } else { // 解析并格式化输出 JSON $data = json_decode($result, true); if ($data) { echo "=== 解析后的结果 ===\n"; echo "状态: " . $data['status'] . "\n"; echo "返回码: " . $data['code'] . "\n"; echo "消息: " . $data['msg'] . "\n"; if (isset($data['data'])) { echo "域名: " . $data['data']['domain'] . "\n"; echo "黑名单等级: " . $data['data']['blackListLevel'] . " "; switch ($data['data']['blackListLevel']) { case 2: echo "(正常域名)\n"; break; case 0: echo "(已列入黑名单)\n"; break; case -1: echo "(状态未知)\n"; break; default: echo "\n"; } } echo "\n=== 原始 JSON ===\n"; echo $result; } else { echo "原始返回内容:\n" . $result; } } ?>

preferences:
53.05 ms | 783 KiB | 5 Q