Advertisement
milio48

file_get_contents.js

May 29th, 2019
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <body id="data">
  4.  
  5. </body>
  6. <script>
  7. function curi(url, id) {
  8.     var xmlhttp = new XMLHttpRequest();
  9.     xmlhttp.onreadystatechange = function() {
  10.       if (this.readyState == 4 && this.status == 200) {
  11.         var str = this.responseText;
  12.         var str = str.replace("[{", "{");
  13.         var str = str.replace("}]", "}");
  14.         var myObj = JSON.parse(str);
  15.         document.getElementById(id).innerHTML = myObj.body;
  16.       }
  17.     };
  18.     xmlhttp.open("GET", "https://api.hack.co.id/header/?domain=" + url, true);
  19.     xmlhttp.send();
  20. }
  21. //          url         element id (ex: <body id="data">)
  22. curi('https://github.com', 'data');
  23. </script>
  24. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement