Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. $apiKey = 'AIzaSyA70vFWBqo9sM-itSDfahGmmByIxdGlkDI';
  2. $url ='http://www.bbc.com/';
  3. $url = urlencode($url);
  4.  
  5. $ch = curl_init();
  6.  
  7. curl_setopt($ch, CURLOPT_URL, "https://sb-ssl.google.com/safebrowsing/api/lookup?client=firefox&key='. $apiKey.'&appver=1.5.2&pver=4.0&url='.$url");
  8. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  9. curl_setopt($ch, CURLOPT_POST, 1);
  10.  
  11. $headers = array();
  12. $headers[] = "Content-Type: application/json";
  13. $headers[] = "Content-length: auto";
  14. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  15.  
  16. $result = curl_exec($ch);
  17. if (curl_errno($ch)) {
  18. echo 'Error:' . curl_error($ch);
  19. }
  20. curl_close ($ch);
  21.  
  22. echo print_r($result, true);
  23.  
  24. $url = 'http://911.sos-empleados.net';
  25.  
  26.  
  27. $apiKey = 'Your API';
  28. $apiUrl = 'https://safebrowsing.googleapis.com/v4/threatMatches:find?key='.$apiKey;
  29.  
  30. $params = [
  31. 'client' => [
  32. 'clientId' => 'foobar',
  33. 'clientVersion' => '1.2.3'
  34. ],
  35. 'threatInfo' => [
  36. "threatTypes" =>["MALWARE", "SOCIAL_ENGINEERING"],
  37. "platformTypes" => ["WINDOWS"],
  38. 'threatEntryTypes' => ['URL'],
  39. 'threatEntries' => [
  40. [ 'url' => $url ]
  41. ]
  42. ]
  43. ];
  44.  
  45.  
  46. $ch = curl_init($apiUrl);
  47. curl_setopt_array($ch, [
  48. CURLOPT_POST => 1,
  49. CURLOPT_RETURNTRANSFER => 1,
  50. CURLOPT_HEADER => 1,
  51. CURLOPT_POSTFIELDS => json_encode($params),
  52. CURLOPT_HTTPHEADER => [
  53. 'Content-Type: text/json'
  54. ]
  55. ]);
  56.  
  57. $res = curl_exec($ch);
  58. ?> <pre><?php echo print_r($res, true); ?></pre> <?php
  59. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement