读书人

求指导简化~解决办法

发布时间: 2012-04-11 17:42:33 作者: rapoo

求指导简化~

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]); 

读书人网 >PHP

热点推荐