Тема: Поиск filmix.co
Здравствуйте ребята подскажите что не так делаю поиск на сайте , может полчаса поработать дальше не работает
<?php
if ( isset( $_REQUEST[ 'search'] ) )//
{
$domen='https://filmix.co';
$search = urlencode($_REQUEST[ 'search']);
$post='scf=fx&story='.$search.'&search_start=0&do=search&subaction=search&years_ot=1902&years_do=2021&kpi_ot=1&kpi_do=10&imdb_ot=1&imdb_do=10&sort_name=&undefined=asc&sort_date=&sort_favorite=&simple=1';
$doc = curl($domen.'/engine/ajax/sphinx_search.php',$post);
//print_r($doc);
preg_match_all('|class="short">.*?src="https(.+?)".*?title="(.+?)".*?itemprop="url" href="(.+?)"|ms', $doc, $maskat);
print_r($maskat);
}
function curl( $url, $post ='' , $mode = array( ) )
{
$defaultmode = array(
'charset' => 'utf-8',
'ssl' => 1,
'cookie' => 1,
'headers' => 1,
'useragent' => 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36'
);
foreach ( $defaultmode as $k => $v )
{
if ( !isset( $mode[ $k ] ) )
$mode[ $k ] = $v;
}
$header =array (
);
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_HEADER, $mode[ 'headers' ] );
curl_setopt( $ch, CURLOPT_HTTPHEADER, $header);
curl_setopt( $ch, CURLOPT_REFERER, $url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_USERAGENT, $mode[ 'useragent' ] );
curl_setopt( $ch, CURLOPT_ENCODING, $mode[ 'charset' ] );
curl_setopt( $ch, CURLOPT_AUTOREFERER, 1 );
curl_setopt( $ch, CURLOPT_TIMEOUT, 200 );
if ( $post )
{
curl_setopt( $ch, CURLOPT_POST, 1 );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $post );
}
if ( $mode[ 'cookie' ] )
{
curl_setopt( $ch, CURLOPT_COOKIEFILE, dirname( __FILE__ ) . 'filmix_cooki.txt' );
curl_setopt( $ch, CURLOPT_COOKIEJAR, dirname( __FILE__ ) . 'filmix_cooki.txt' );
}
curl_setopt( $ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );
if ( $mode[ 'ssl' ] )
{
curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 );
}
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
$data = curl_exec( $ch );
//$sent_headers = curl_getinfo($ch, CURLINFO_HEADER_OUT);
//print_r( $sent_headers);
curl_close( $ch );
return $data;
}