Я сделал граббер Андроид программы с сайта gegas.net, но у меня не работает поиск:
Ссылка на поиск
скажите пожалуйста в чем проблема?
Я сделал граббер Андроид программы с сайта gegas.net, но у меня не работает поиск:
Ссылка на поиск
скажите пожалуйста в чем проблема?
Код граббера надо опубликовать для начала.
Переместил ![]()
<?php
define('_IN_JOHNCMS', 1);
$textl = 'Загрузки для Андроид';
require_once ("../incfiles/core.php");
require_once ("../incfiles/head.php");
header("Content-type:text/html; charset=utf-8");
$id = $_GET['id'];
$file = file_get_contents('http://gegas.net/android/'
. (!empty($id) ? $id : ''));
$file = preg_replace('|<!DOCTYPE(.*?)<section id="content">|si', '', $file);
$file = str_replace('<section>', '', $file);
$file = str_replace('</section>', '', $file);
$file = preg_replace('|<li><a href="/">На главную</a>(.*)</html>|si', '', $file);
$file = str_replace('<a class="button"', '<a class="bmenu"', $file);
$file = str_replace('<li>', '<div class="menu">', $file);
$file = str_replace('</li>', '</div>', $file);
$file = str_replace('<h2>', '<div class="phdr">', $file);
$file = str_replace('</h2>', '</div>', $file);
$file = str_replace('<ul>', '', $file);
$file = str_replace('</ul>', '', $file);
$file = str_replace('<aside>', '', $file);
$file = str_replace('</aside>', '', $file);
$file = str_replace('<a href="http://gegas.net/android/downloads/directory/', '<a href="' . $set['homeurl'] . '/android/?id=downloads/directory/', $file);
$file = str_replace('href="http://gegas.net/android/downloads/top', 'href="' . $set['homeurl'] . '/android/?id=downloads/top', $file);
$file = str_replace('href="http://gegas.net/android/downloads/news', 'href="' . $set['homeurl'] . '/android/?id=downloads/news', $file);
$file = str_replace('href="http://gegas.net/android/downloads/search', 'href="' . $set['homeurl'] . '/android/?id=downloads/search', $file);
$file = str_replace('href="http://gegas.net/android/downloads/object', 'href="' . $set['homeurl'] . '/android/?id=downloads/object', $file);
$file = str_replace('<h2 class="title_search">', '<div class="phdr">', $file);
$file = str_replace('<form action="http://gegas.net/android/downloads/search', '<form action="' . $set['homeurl'] . '/android/?id=downloads/search', $file);
$file = str_replace('href="http://gegas.net/android', 'href="' . $set['homeurl'] . '/android', $file);
echo $file;
require("../incfiles/end.php");
?>Bahakz, а код файла с поиском? Граббер ведь на него ссылается в последней ссылке, и он должен лежать на твоём хосте.
Был бы дома,с ПК,помог бы
<?php
define('_IN_JOHNCMS', 1);
$textl = 'Загрузки для Андроид';
require_once ("../incfiles/core.php");
require_once ("../incfiles/head.php");
header("Content-type:text/html; charset=utf-8");
#################
function curl_get ( $url ){
$curl = curl_init ();curl_setopt ( $curl , CURLOPT_URL , $url );
curl_setopt ( $curl , CURLOPT_USERAGENT , 'Opera/9.80(Windows NT 5.1; U; ru) Presto/2.2.15 Version/10.10' );
curl_setopt ( $curl , CURLOPT_RETURNTRANSFER , 1 );
curl_setopt ( $curl , CURLOPT_TIMEOUT , 3 );
$cnt = curl_exec ( $curl );
curl_close ( $curl );
return $cnt ;
}
$file = curl_get ( 'http://gegas.net/android/downloads/search/?' . $_SERVER [ 'QUERY_STRING' ]);
$file = str_replace ( '/android/downloads/search/' , 'adnroid' , $file );
$file = preg_replace('|<!DOCTYPE(.*?)<section id="content">|si', '', $file);
$file = str_replace('<section>', '', $file);
$file = str_replace('</section>', '', $file);
$file = preg_replace('|<li><a href="/">На главную</a>(.*)</html>|si', '', $file);
$file = str_replace('<a class="button"', '<a class="bmenu"', $file);
$file = str_replace('<li>', '<div class="menu">', $file);
$file = str_replace('</li>', '</div>', $file);
$file = str_replace('<h2>', '<div class="phdr">', $file);
$file = str_replace('</h2>', '</div>', $file);
$file = str_replace('<ul>', '', $file);
$file = str_replace('</ul>', '', $file);
$file = str_replace('<aside>', '', $file);
$file = str_replace('</aside>', '', $file);
$file = str_replace('<form action="http://gegas.net/android/downloads/search', '<form action="/android/p.php?id=downloads/search', $file);
$file = str_replace('<a href="http://gegas.net/android/downloads/directory/', '<a href="/android/?id=downloads/directory/', $file);
$file = str_replace('href="http://gegas.net/android/downloads/top', 'href="/android/?id=downloads/top', $file);
$file = str_replace('href="http://gegas.net/android/downloads/news', 'href="/android/?id=downloads/news', $file);
$file = str_replace('href="http://gegas.net/android/downloads/search', 'href="/android/?id=downloads/search', $file);
$file = str_replace('href="http://gegas.net/android/downloads/object', 'href="/android/?id=downloads/object', $file);
$file = str_replace('<h2 class="title_search">', '<div class="phdr">', $file);
echo $file ;
##################
require("../incfiles/end.php");
?>то что кинул там надо еще пагинатор дописать
Ужос а не код...
В общем что бы поиск работал надо делать для него отдельный файл, там принимать поисковый запрос, передавать его на сайт-источник и грабить полученный результат. Либо можно использовать кейсы или иф/елсе и обойтись одним файлом.
# fanatos (15.04.2016 / 15:24)Спасибо, работает
<?php
define('_IN_JOHNCMS', 1);
$textl = 'Загрузки для Андроид';
require_once ("../incfiles/core.php");
require_once ("../incfiles/head.php");
header("Content-type:text/html; charset=utf-8");