diff options
Diffstat (limited to 'store/browser/curl.php')
-rw-r--r-- | store/browser/curl.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/store/browser/curl.php b/store/browser/curl.php new file mode 100644 index 0000000..2692108 --- /dev/null +++ b/store/browser/curl.php @@ -0,0 +1,20 @@ +<?php + +require_once ('/home/grizzly/store/browser/db.php'); + +$c = curl_init(); +curl_setopt($c, CURLOPT_URL,'https://tilde.team/'); +curl_setopt($c, CURLOPT_RETURNTRANSFER, true); +$data = curl_exec($c); +curl_close($c); + +preg_match_all('/<li><a href="\/~(.*)\/" class=\"list-group-item col-xs-6 col-sm-4 col-md-2\">~(.*)<\/a><\/li>/', $data, $matches); + +foreach ($matches[1] as $user) { + $stmt = $db->prepare("INSERT INTO `websites` (login_name) VALUES(:login_name)"); + $stmt->bindParam(':login_name', $user); + $stmt->execute(); +} + + +?> \ No newline at end of file |