<?php include 'content.php'; include 'table_csv.php'; /* $rec = strip_link( '/projects/html_parsing/tmp/', '2014' ); foreach ($rec as $stuff) echo $stuff; */ $links = strip_link('2013', '/home/scapista/git/football-stats/tmp/'); foreach ($links as $link_prt) { print $link_prt; } //need to add option for this function to take an address //table_csv( 'boxscore.html@gid=2014091101' , '/home/scapista/git/football-stats/tmp/' );
} if (count($match[0])) { $str2 = str_replace($match[0], $match[1], $str); } return $str2; } /* $con = mysql_connect('localhost','root','') or die('Could not connect:' . mysql_error()); mysql_select_db('love',$con) or die('Could not use love:' . mysql_error()); mysql_query('SET NAMES UTF8'); $sql = "SELECT * FROM passage WHERE id=20"; $result = mysql_query($sql,$con) or die("\"$sql\" error:" . mysql_error()); $row = mysql_fetch_array($result); $str = $row['content']; echo $str; $str = file_get_contents('http://www.hao123.com/'); $pattern = '/<a[\s\S]*?href=["|\'][\s\S]*?["|\']>([\S\s]*?)<\/a>/i'; preg_match_all($pattern,$str,$match); var_dump($match); echo '<hr>'; $str1 = str_replace($match[0],$match[1],$str); //$str1 = preg_replace($pattern,$match[1],$str); //$str1 = preg_replace($match[0],$match[1],$str); //$str1 = preg_replace($pattern,'XML_OPTION_CASE_FOLDING',$str); //$str1 = preg_replace($match[0],$match[1],$str);//Warning: preg_replace(): in 什么意思? echo $str1; */ //测试 $str = file_get_contents('http://www.smilewind.com'); $str2 = strip_link($str, 2); echo $str2;