Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 или закоментить то будут заголовки перед редиректом
- $cc = curl_exec($ch);
- curl_close($ch);
- return $cc;
- }
- public static function getParss($regulat,$body){
- //echo $body;
- preg_match_all($regulat, $body, $matches);
- //print_r($matches);
- return $matches;
- }
- }
- $parsRss = Pars::getContent("https://shazoo.ru/feed/rss");
- $xmlLink = Pars::getParss('~<h3><a.+?href="(.+?)".+?<\/h3>~su',$parsRss);
- print_r($xmlLink)."<br>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement