首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

求指导简化~解决办法

2012-04-11 
求指导简化~PHP code?php //调用格式:localhost/getpro.php?useridslowstang95///$userid$_GET[userid

求指导简化~

PHP code
<?php //调用格式:localhost/getpro.php?userid=slowstang95///$userid=$_GET["userid"];$url="http://feedback.ebay.com/ws/eBayISAPI.dll?ViewFeedback2&userid=".$userid;$str=file_get_contents($url);$start='</span></a> <span class="mbg-l"> ( ';$end='<img src="http://q.ebaystatic';$content=str_substr($str , $start, $end); echo $content; function str_substr($str ,$start, $end) {     $x = strpos($str, $start);     $y = strpos($str, $end);    $getstr= substr($str,$x+strlen($start),$y-$x);      $getstr2=str_replace('<img src="http://q.ebaystatic.com/a',"",$getstr); //!!!    return $getstr2;}?>


[解决办法]
PHP code
$userid=$_GET["userid"];$url="http://feedback.ebay.com/ws/eBayISAPI.dll?ViewFeedback2&userid=".$userid;$str=file_get_contents($url);$pattern='/<span class="mbg-l">\s*\((.*?)<img src="http:\/\/q\.ebaystatic\.com\/a/';preg_match($pattern,$str,$match);print_r($match[1]); 

热点排行