Home > Backend Development > PHP Tutorial > PHP analysis of RSS code section_PHP tutorial

PHP analysis of RSS code section_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 16:54:20
Original
793 people have browsed it

function my_headlines($url) {
      $rdf = parse_url($url);
      $fp = fsockopen($rdf['host'], 80, $errno, $errstr, 15);
      if (!$fp) {
     $content = "Problema!";
     return;
      }
      if ($fp) {
     fputs($fp, "GET " . $rdf['path'] . "?" . $rdf['query'] . " HTTP/1.0 ");
     fputs($fp, "HOST: " . $rdf['host'] . " ");
     $string = "";
     while(!feof($fp)) {
     $pagetext = fgets($fp,300);
     $string .= chop($pagetext);
 }
 fputs($fp,"Connection: close ");
 fclose($fp);
 $items = explode("",$string);
 $content = "";
 for ($i=0;$i<10;$i++) {
     $link = ereg_replace(".*","",$items[$i]);
     $link = ereg_replace(".*","",$link);
     $title2 = ereg_replace(".*","",$items[$i]);<br>     $title2 = ereg_replace(".*","",$title2);
     if ($items[$i] == "") {
         $content = "";
         return;
     } else {
         if (strcmp($link,$title)) {
       $cont = 1;
      $content .= "$title2
";
    }
     }
 }
      }
      echo "$content";
}
my_headlines
?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/631791.htmlTechArticle?php function my_headlines($url) { $rdf = parse_url($url); $fp = fsockopen($rdf['host'], 80, $errno, $errstr, 15); if (!$fp) { $content = "font class="content"Problema!/font"; retur...
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template