Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'phpQuery.php';
- $url = curl_init();
- curl_setopt($url, CURLOPT_URL, "http://33tura.ru/flagi");
- curl_setopt($url, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($url, CURLOPT_FOLLOWLOCATION, 1);
- $str = curl_exec($url);
- $pq = phpQuery::newDocument($str);
- $table = $pq->find("table");
- $host = 'localhost';
- $user = 'root';
- $password = '';
- $db_name = 'phpquery';
- $connect = mysqli_connect($host, $user, $password, $db_name) or die(mysqli_error($link));
- foreach ($table as $items){
- $items = pq($items);
- $img = $items->find('td img')->attr('src');
- $flag = 'http://33tura.ru/'.$img;
- $file = file_get_contents($flag);
- file_put_contents('../img/', $file);
- $naname = $items->find('td a');
- $query = "INSERT INTO page (id, title) VALUES (null, '".$name."')";
- $result = mysqli_query($connect, $query);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement