\n";
for ($i = 0; $i < count($arr_xml['URL']); $i++) {
if( isset($arr_xml['PostID'][$i]) && $arr_xml['PostID'][$i] > 0 ) continue;
echo "
".$arr_xml['BeforeText'][$i]." ".$arr_xml['Text'][$i]." ".$arr_xml['AfterText'][$i]."\n";
}
echo "";
}
}
function tla_updateLocalXML($url, $file, $time_out)
{
if($handle = fopen($file, "a")){
fwrite($handle, "\n");
fclose($handle);
}
if($xml = file_get_contents_tla($url, $time_out)) {
$xml = substr($xml, strpos($xml,''));
if ($handle = fopen($file, "w")) {
fwrite($handle, $xml);
fclose($handle);
}
}
}
function tla_getLocalXML($file)
{
$contents = "";
if($handle = fopen($file, "r")){
$contents = fread($handle, filesize($file)+1);
fclose($handle);
}
return $contents;
}
function file_get_contents_tla($url, $time_out)
{
$result = "";
$url = parse_url($url);
if ($handle = @fsockopen ($url["host"], 80)) {
if(function_exists("socket_set_timeout")) {
socket_set_timeout($handle,$time_out,0);
} else if(function_exists("stream_set_timeout")) {
stream_set_timeout($handle,$time_out,0);
}
fwrite ($handle, "GET $url[path]?$url[query] HTTP/1.0\r\nHost: $url[host]\r\nConnection: Close\r\n\r\n");
while (!feof($handle)) {
$result .= @fread($handle, 40960);
}
fclose($handle);
}
return $result;
}
function tla_decodeXML($xmlstg)
{
if( !function_exists('html_entity_decode') ){
function html_entity_decode($string)
{
// replace numeric entities
$string = preg_replace('~([0-9a-f]+);~ei', 'chr(hexdec("\1"))', $string);
$string = preg_replace('~([0-9]+);~e', 'chr(\1)', $string);
// replace literal entities
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
}
$out = "";
$retarr = "";
preg_match_all ("/<(.*?)>(.*?)", $xmlstg, $out, PREG_SET_ORDER);
$search_ar = array('<', '>', '"');
$replace_ar = array('<', '>', '"');
$n = 0;
while (isset($out[$n]))
{
$retarr[$out[$n][1]][] = str_replace($search_ar, $replace_ar,html_entity_decode(strip_tags($out[$n][0])));
$n++;
}
return $retarr;
}
tla_ads();
?>
Comments (9)
够专业的!! 呵呵
Posted by pickgliss | August 29, 2008 8:36 AM
Posted on August 29, 2008 08:36
这个功能很适合做竞价排名啊,呵呵
Posted by sumnny | August 29, 2008 8:52 AM
Posted on August 29, 2008 08:52
还需要装插件啊?
Posted by Ethan | August 29, 2008 10:36 AM
Posted on August 29, 2008 10:36
在IE8的加速器安装首页有个“淘宝搜索”,黑羽说的应该就是那个吧。
Posted by hobby | August 29, 2008 2:32 PM
Posted on August 29, 2008 14:32
to hobby:
不是,那个是Accelerator,我这篇文章说的是Visual Search,ie8gallery这个页面有:http://www.ieaddons.com/cn/Details.aspx?Id=872
Posted by 黑羽 | August 29, 2008 5:06 PM
Posted on August 29, 2008 17:06
试用了下,还不错撒
Posted by 那年那月 | September 1, 2008 12:10 PM
Posted on September 1, 2008 12:10
试用,谢谢.
Posted by chinese tea | September 21, 2008 9:27 AM
Posted on September 21, 2008 09:27
支付功能不支持IE8,弄这些还有什么用。
Posted by yuyangvi | November 13, 2008 3:19 PM
Posted on November 13, 2008 15:19
别惯着IE%……
Posted by cuikai | February 17, 2009 11:28 PM
Posted on February 17, 2009 23:28