<? phpfunctiongetSubstr($str, $leftStr, $rightStr) {
$left = strpos($str, $leftStr);
$right = strpos($str, $rightStr, $left);
if ($left < 0 or $right < $left) return '';
return substr($str, $left + strlen($leftStr), $right - $left - strlen($leftStr));
}
$html = file_get_contents("http://api.t.sina.com.cn/short_url/shorten.xml?source=3213676317&url_long=$_GET[name]");
echo getSubstr($html, "<url_short>", "</url_short>"); ?>
$left = strpos($str, $leftStr);
$right = strpos($str, $rightStr, $left);
if ($left < 0 or $right < $left) return '';
return substr($str, $left + strlen($leftStr), $right - $left - strlen($leftStr));
}
$html = file_get_contents("http://api.t.sina.com.cn/short_url/shorten.xml?source=3213676317&url_long=$_GET[name]");
echo getSubstr($html, "<url_short>", "</url_short>"); ?>
暂无评论...