用php读取远程文件
//读取远程rss内容function addRss($id,$url){ $doc = new DOMDocument();$doc->load($url); $books = $doc->getElementsByTagName("item"); foreach( $books as $book ) { $titles = $book->getElementsByTagName("title"); $title = chop($titles->item(0)->nodeValue); $links = $book->getElementsByTagName("link"); $link = chop($links->item(0)->nodeValue); $descriptions = $book->getElementsByTagName("description"); $description = chop($descriptions->item(0)->nodeValue); $pubDates = $book->getElementsByTagName("pubDate"); $pubDate = chop($pubDates->item(0)->nodeValue); $filepath=date("Ymd");$sql="INSERT INTO rsscon (catalog1,sub1,url1,con1,addDate,filePath) values ($id,'$title','$link','$description','$pubDate','$filepath')"; echo " ";if(mysql_query($sql)){echo ("Last inserted record has id ".mysql_insert_id()."");}else{echo $sql;}}} [...]
