Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header('Content-type: text/html; charset=UTF-8');
- class Pars{
- public static function getContent($url=false){
- //echo $url."<br>Новая";
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL,$url);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);//CURLOPT_CONNECTTIMEOUT_MS
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 350);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);//если посставить 0 или закоментить то будут заголовки перед редиректом
- curl_setopt($ch,CURLOPT_ENCODING, '');
- curl_setopt( $ch, CURLOPT_COOKIESESSION, true );
- curl_setopt($ch, CURLOPT_HTTPHEADER, array("Cookie: DDOSEXPERT_COM_V3=ca0a834787bbffd5f900af68529785c2"));
- $cc = curl_exec($ch);
- curl_close($ch);
- return $cc;
- }
- public static function getPars($regulat,$body,$one,$two){
- preg_match_all($regulat, $body, $matches);
- return $matches[$one][$two];
- }
- public static function getParss($regulat,$body){
- //echo $body;
- preg_match_all($regulat, $body, $matches);
- //print_r($matches);
- return $matches;
- }
- }
- //<[^>]*>
- //$pars = Pars::getContent("https://www.igromania.ru/rss/rss_articles.xml");
- //$urlLink = Pars::getPars('~\<link\>(.*?)\<\/link\>~',$pars,"0","1");
- //echo $urlLink."<br>";
- $pars1 = Pars::getContent("https://www.igromania.ru/article/30505/Metro_Exodus_Ob_oruzhii_narrative_i_buduschem_studii.html");
- echo $pars1;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement