<?php
/**
* Defining constants for the CGI parameters of the HTTP GET Request
* */
define ( 'API_KEY', "YOUR_API_KEY" ); //발급받은 API KEY 입력
define ( 'PROTOCOL_VER', '3.0' );
define ( 'CLIENT', 'checkURLapp' );
define ( 'APP_VER', '1.0' );
/**
* Function for sending a HTTP GET Request
* to the Google Safe Browsing Lookup API
*/
function get_data($url) {
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, $url );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYHOST, false );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
$data = curl_exec ( $ch );
$httpStatus = curl_getinfo ( $ch, CURLINFO_HTTP_CODE );
curl_close ( $ch );
return array (
'status' => $httpStatus,
'data' => $data
);
}
/**
* Function for analyzing and paring the
* data received from the Google Safe Browsing Lookup API
*/
function send_response($input) {
if (! empty ( $input )) {
$urlToCheck = urlencode ( $input );
$url = 'https://sb-ssl.google.com/safebrowsing/api/lookup?client=' . CLIENT . '&apikey=' . API_KEY . '&appver=' . APP_VER . '&pver=' . PROTOCOL_VER . '&url=' . $urlToCheck;
$response = get_data ( $url );
if ($response ['status'] == 204) {
return json_encode ( array (
'status' => 204,
'checkedUrl' => $urlToCheck,
'message' => 'The website is not blacklisted and looks safe to use.'
) );
} elseif ($response ['status'] == 200) {
return json_encode ( array (
'status' => 200,
'checkedUrl' => $urlToCheck,
'message' => 'The website is blacklisted as ' . $response ['data'] . '.'
) );
} else {
return json_encode ( array (
'status' => 501,
'checkedUrl' => $urlToCheck,
'message' => 'Something went wrong on the server. Please try again.'
) );
}
} else {
return json_encode ( array (
'status' => 401,
'checkedUrl' => '',
'message' => 'Please enter URL.'
) );
}
;
}
$checkMalware = send_response ('URL'); //검사할 URL 입력
$checkMalware = json_decode($checkMalware, true);
$malwareStatus = $checkMalware['status'];
echo $malwareStatus;
?>
/**
* Defining constants for the CGI parameters of the HTTP GET Request
* */
define ( 'API_KEY', "YOUR_API_KEY" ); //발급받은 API KEY 입력
define ( 'PROTOCOL_VER', '3.0' );
define ( 'CLIENT', 'checkURLapp' );
define ( 'APP_VER', '1.0' );
/**
* Function for sending a HTTP GET Request
* to the Google Safe Browsing Lookup API
*/
function get_data($url) {
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, $url );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYHOST, false );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
$data = curl_exec ( $ch );
$httpStatus = curl_getinfo ( $ch, CURLINFO_HTTP_CODE );
curl_close ( $ch );
return array (
'status' => $httpStatus,
'data' => $data
);
}
/**
* Function for analyzing and paring the
* data received from the Google Safe Browsing Lookup API
*/
function send_response($input) {
if (! empty ( $input )) {
$urlToCheck = urlencode ( $input );
$url = 'https://sb-ssl.google.com/safebrowsing/api/lookup?client=' . CLIENT . '&apikey=' . API_KEY . '&appver=' . APP_VER . '&pver=' . PROTOCOL_VER . '&url=' . $urlToCheck;
$response = get_data ( $url );
if ($response ['status'] == 204) {
return json_encode ( array (
'status' => 204,
'checkedUrl' => $urlToCheck,
'message' => 'The website is not blacklisted and looks safe to use.'
) );
} elseif ($response ['status'] == 200) {
return json_encode ( array (
'status' => 200,
'checkedUrl' => $urlToCheck,
'message' => 'The website is blacklisted as ' . $response ['data'] . '.'
) );
} else {
return json_encode ( array (
'status' => 501,
'checkedUrl' => $urlToCheck,
'message' => 'Something went wrong on the server. Please try again.'
) );
}
} else {
return json_encode ( array (
'status' => 401,
'checkedUrl' => '',
'message' => 'Please enter URL.'
) );
}
;
}
$checkMalware = send_response ('URL'); //검사할 URL 입력
$checkMalware = json_decode($checkMalware, true);
$malwareStatus = $checkMalware['status'];
echo $malwareStatus;
?>
게시글 목록
| 번호 | 제목 |
|---|---|
| 23606 | |
| 23598 | |
| 23585 | |
| 23579 | |
| 23578 | |
| 23564 | |
| 23550 | |
| 23549 | |
| 23548 | |
| 23529 | |
| 23510 | |
| 23507 | |
| 23481 | |
| 23471 | |
| 23453 | |
| 23452 | |
| 23450 | |
| 23436 | |
| 23428 | |
| 23404 | |
| 23396 | |
| 23389 | |
| 23380 | |
| 23369 | |
| 23350 | |
| 23337 | |
| 23317 | |
| 23307 | |
| 23298 | |
| 23290 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기