diff options
author | Sebastian Korotkiewicz <skorotkiewicz@gmail.com> | 2022-03-19 09:17:55 +0100 |
---|---|---|
committer | Sebastian Korotkiewicz <skorotkiewicz@gmail.com> | 2022-03-19 09:17:55 +0100 |
commit | 53da95395aad137bd0ab2b2f4ed1e9e3cb00c962 (patch) | |
tree | b101ce45b258711180a1cc16fcc27bdf5d252241 /store/browser/curl.php | |
download | site_roulette-53da95395aad137bd0ab2b2f4ed1e9e3cb00c962.tar.gz |
Initial commit
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 |