Advertisement
339r

Untitled

Feb 16th, 2020
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.97 KB | None | 0 0
  1. <?php
  2. if (isset($_GET['Data'])) {
  3.     $url = 'https://spreadsheets.google.com/feeds/list/1ihKImjXrk8--YaRIrWHWjMs4thRNN7Le3xoAB4hrLFE/od6/public/values?alt=json';
  4.     function curl_get_contents($url)
  5. {
  6. $ch = curl_init();
  7. $timeout = 5;
  8.  
  9. curl_setopt($ch, CURLOPT_URL, $url);
  10. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  11. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  12. curl_setopt($ch, CURLOPT_HEADER, false);
  13. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
  14.  
  15. $data = curl_exec($ch);
  16.  
  17. curl_close($ch);
  18.  
  19. return $data;
  20. }
  21. $key ="";
  22. $contents = curl_get_contents($url);
  23.  
  24. $text = $contents;
  25. preg_match_all('/"gsx\$username":{"\$t":"(.*?)"},"gsx\$password":{"\$t":"(.*?)"}}/', $text, $matches, PREG_SET_ORDER);
  26. header('Content-Type: application/json');
  27. $data = array();
  28. foreach ($matches as $match) {
  29.     $arrayme = ['NAME' => $match[1], 'PASSWORD' => $match[2]];
  30. array_push($data, $arrayme);
  31. }
  32.     $data_out = $data;
  33.     echo json_encode($data_out, JSON_FORCE_OBJECT);
  34. }
  35.  
  36.  ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement