如何使用fopen或fsockopen获取反馈

I need your help to create simple php code with fopen or fsockopen

I want to check ips by http://www.projecthoneypot.org/ip_xx.xx.xx.xx and get feedback

For example :

The user ip is 127.0.0.1

Now i will use fopen or fsockopen to ckeck if the projecthoneypot.org have any info about it or not

http://www.projecthoneypot.org/ip_127.0.0.1

if "don't have data on this IP currently" echo "No Date" else "Data Was Found"

Please help

Hmm... simple code:

$response = file_get_contents("http://www.projecthoneypot.org/ip_127.0.0.1");
$match = preg_match("/don't have data on this IP currently/i", $response);

if($match) {
    echo "No Date";
} else {
    echo "Data Was Found";
}

Or with curl:

$ch = curl_init();

curl_setopt_array($ch, array(
    CURLOPT_URL => 'http://www.projecthoneypot.org/ip_127.0.0.1',
    CURLOPT_HEADER => false,
    CURLOPT_RETURNTRANSFER => true,
));

$response = curl_exec($ch);
curl_close($ch);

$match = preg_match("/don't have data on this IP currently/i", $response);

if($match) {
    echo "No Date";
} else {
    echo "Data Was Found";
}

I suggest using fsockopen as it allows you to easily define a timeout. However it does require sockets to be enabled in the config.