Created
November 1, 2017 22:34
-
-
Save DonPramis/421f94ee3dbcca96f0e718a6b12615b2 to your computer and use it in GitHub Desktop.
Get Norton Safe
This file contains 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 | |
public function getNortonSafe($domain) | |
{ | |
try | |
{ | |
$callback_url = "https://safeweb.norton.com/report/show?url=" . $domain; | |
$curl_response = $this->curl->get($callback_url); | |
if ($curl_response->headers['Status-Code'] == "200") { | |
libxml_use_internal_errors(TRUE); | |
$this->dom_doc->loadHTML($curl_response); | |
libxml_use_internal_errors(FALSE); | |
$xpath = new DOMXPath($this->dom_doc); | |
$tmp = $xpath->query('//*[@id="bodyContent"]/div/div/div[3]/div[1]/div[1]/div[2]/div[1]/div/b')->item(0)->textContent); | |
$tmp = explode(' ', trim($tmp)); | |
$norton_site_test = str_replace(",", "", $tmp[0]); | |
} else { | |
$norton_site_test = "0"; | |
} | |
$response = array( | |
'status' => 'success', | |
'data' => array( | |
'norton_site_test' => filter_var($norton_site_test,textContent) | |
) | |
); | |
} | |
catch (Exception $e) | |
{ | |
$response = array( | |
'status' => 'error', | |
'msg' => $e->getMessage() | |
); | |
} | |
return $response; | |
} | |
?> | |
HTML | |
<body> | |
<p id="norton_site_test"> result-text-here </p> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment