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; } } ?>
Output for 8.5.0 - 8.5.3
Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/c6k0a on line 23 Warning: file_get_contents(https://apistore.aizhan.com/icp/checkdomain/c7b9a2de14b386f7a7dde163f2ecac98?domain=aizhan.com): Failed to open stream: No such file or directory in /in/c6k0a on line 23 请求失败,请检查网络或 URL 是否正确。 尝试访问的 URL: https://apistore.aizhan.com/icp/checkdomain/c7b9a2de14b386f7a7dde163f2ecac98?domain=aizhan.com Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/c6k0a on line 75 Warning: file_get_contents(https://apistore.aizhan.com/icp/checkdomain/c7b9a2de14b386f7a7dde163f2ecac98?domain=aizhan.com): Failed to open stream: No such file or directory in /in/c6k0a on line 75 请求失败,请检查网络或 URL 是否正确。 尝试访问的 URL: https://apistore.aizhan.com/icp/checkdomain/c7b9a2de14b386f7a7dde163f2ecac98?domain=aizhan.com
Output for 8.3.0 - 8.3.30, 8.4.1 - 8.4.18
Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/c6k0a on line 23 Warning: file_get_contents(): open_basedir restriction in effect. File(https://apistore.aizhan.com/icp/checkdomain/c7b9a2de14b386f7a7dde163f2ecac98?domain=aizhan.com) is not within the allowed path(s): (/tmp:/in:/etc) in /in/c6k0a on line 23 Warning: file_get_contents(https://apistore.aizhan.com/icp/checkdomain/c7b9a2de14b386f7a7dde163f2ecac98?domain=aizhan.com): Failed to open stream: Operation not permitted in /in/c6k0a on line 23 请求失败,请检查网络或 URL 是否正确。 尝试访问的 URL: https://apistore.aizhan.com/icp/checkdomain/c7b9a2de14b386f7a7dde163f2ecac98?domain=aizhan.com Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/c6k0a on line 75 Warning: file_get_contents(): open_basedir restriction in effect. File(https://apistore.aizhan.com/icp/checkdomain/c7b9a2de14b386f7a7dde163f2ecac98?domain=aizhan.com) is not within the allowed path(s): (/tmp:/in:/etc) in /in/c6k0a on line 75 Warning: file_get_contents(https://apistore.aizhan.com/icp/checkdomain/c7b9a2de14b386f7a7dde163f2ecac98?domain=aizhan.com): Failed to open stream: Operation not permitted in /in/c6k0a on line 75 请求失败,请检查网络或 URL 是否正确。 尝试访问的 URL: https://apistore.aizhan.com/icp/checkdomain/c7b9a2de14b386f7a7dde163f2ecac98?domain=aizhan.com

preferences:
55.16 ms | 782 KiB | 4 Q