Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > it.comp.www.php > #21914

Prelievo dati di un sito

From "antonio" <22553invalid@mynewsgate.net>
Newsgroups it.comp.www.php
Subject Prelievo dati di un sito
Message-ID <2018031609060422553@mynewsgate.net> (permalink)
Date 2018-03-16 09:06 +0000

Show all headers | View raw


Lo script e sotto riportato provvede a prelevare dei singoli annunci da 
un sito

su altri siti Funziona correttamente  ma sul sito inserito sembra che รจ 
bloccato da qualcosa in quanto non stampa niente a video


#  SCARiCA UNA PAGINA WEB
############################################# #  


$opts = array(
 'http'=>array(
   'method'=>"GET",
   'header'=>"Accept-language: en\r\n".
             "Cookie: foo=bar\r\n".
             "User-Agent: Mozilla/5.0 (Windows NT 6.1) 

AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 

Safari/537.36\r\n"
 )
);
$context = stream_context_create($opts);
$url = "https://www.infojobs.it/offerte-lavoro";
$input = file_get_contents($url, false, $context);

# echo $input;

$regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<

\/a>";
if(preg_match_all("/$regexp/siU", $input, $matches, 

PREG_SET_ORDER))
{
foreach($matches as $match)
{
$href = strtolower($match[2]);
$inner = strtolower($match[3]);
$pos = (strpos($inner,'<img')> 0) ? true : false;
$inner = strip_tags($inner);
$inner = ($inner == "") ? $url : $inner;
if(!$pos)
$linko = '<a href="' . $href . '">' . $inner . '</a><br/>';

#  CERCA 

$testoannu=substr($href,-4,4);
if ($testoannu == '-new' ) {

$contenuto = 'https:'.$href;

echo $contenuto;
echo "<BR>";

$annuncio = file_get_contents($contenuto, false,

$context);

echo $annuncio;
echo "<BR>";
}

}
}

Back to it.comp.www.php | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Prelievo dati di un sito "antonio" <22553invalid@mynewsgate.net> - 2018-03-16 09:06 +0000
  Re: Prelievo dati di un sito Sandro kensan <kensan@kensan.it> - 2018-03-16 11:35 +0100
    Re: Prelievo dati di un sito "antonio" <22553invalid@mynewsgate.net> - 2018-03-16 16:59 +0000
      Re: Prelievo dati di un sito Alessandro Pellizzari <shuriken@amiran.it> - 2018-03-16 17:36 +0000
        Re: Prelievo dati di un sito fmassei@gmail.com - 2018-03-16 12:35 -0700
  Re: Prelievo dati di un sito Leonardo Serni <lserni@gmail.com> - 2018-03-16 18:57 +0100

csiph-web