\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 (11)
呵呵 支持一个
Posted by 秋色烽火 | March 13, 2008 9:34 AM
Posted on March 13, 2008 09:34
好事成双,路过,顶一下。
Posted by 空中逍客网 | March 13, 2008 2:47 PM
Posted on March 13, 2008 14:47
可惜太远了 呵呵 不然一定去
Posted by yingnierxiao | March 15, 2008 5:59 PM
Posted on March 15, 2008 17:59
他们翻译的ppk on javascript出版了吗,
在哪里可以买的到呀
Posted by zr | March 22, 2008 1:53 AM
Posted on March 22, 2008 01:53
顶,支持。。不过确实太远了。
Posted by IP空间站 | March 26, 2008 5:54 PM
Posted on March 26, 2008 17:54
今年北京4月底,雅虎举办了D2前端技术讨论会,听说你也会去是吗,希望到时候能够和你见面交流一下。
Posted by powerboy | April 9, 2008 12:13 PM
Posted on April 9, 2008 12:13
路过 买了你的书,很厉害哦
可是你的blog更新好慢。。。哦
Posted by marshane | April 25, 2008 11:47 PM
Posted on April 25, 2008 23:47
支持呢
Posted by sngu0 | May 2, 2008 3:28 PM
Posted on May 2, 2008 15:28
to marshane:
接受批评,从今天尽量抽空,恢复正常更新频率,呵呵。
Posted by 黑羽 | May 4, 2008 3:24 AM
Posted on May 4, 2008 03:24
恭喜
Posted by replica handbags | May 4, 2008 5:07 PM
Posted on May 4, 2008 17:07
想在你们站打个广告,怎么联系,看到请联系我QQ:15078707
Posted by 新开传世私服 | May 6, 2008 10:43 AM
Posted on May 6, 2008 10:43