Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_GET['Data'])) {
- $url = 'https://spreadsheets.google.com/feeds/list/1ihKImjXrk8--YaRIrWHWjMs4thRNN7Le3xoAB4hrLFE/od6/public/values?alt=json';
- function curl_get_contents($url)
- {
- $ch = curl_init();
- $timeout = 5;
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HEADER, false);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
- $data = curl_exec($ch);
- curl_close($ch);
- return $data;
- }
- $key ="";
- $contents = curl_get_contents($url);
- $text = $contents;
- preg_match_all('/"gsx\$username":{"\$t":"(.*?)"},"gsx\$password":{"\$t":"(.*?)"}}/', $text, $matches, PREG_SET_ORDER);
- header('Content-Type: application/json');
- $data = array();
- foreach ($matches as $match) {
- $arrayme = ['NAME' => $match[1], 'PASSWORD' => $match[2]];
- array_push($data, $arrayme);
- }
- $data_out = $data;
- echo json_encode($data_out, JSON_FORCE_OBJECT);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement