about summary refs log tree commit diff stats
path: root/store/browser/curl.php
blob: 26921085aaaf80b090711b8acc02a94c8ecf2fe7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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();
}


?>