about summary refs log blame commit diff stats
path: root/store/browser/curl.php
blob: 26921085aaaf80b090711b8acc02a94c8ecf2fe7 (plain) (tree)



















                                                                                                                                   
<?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();
}


?>