<?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;
}
?>

解决方案 »

  1.   

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

  2.   

    高手啊..膜拜,学习了,另外请教一下,在这我原先的基础上用strpos的第三个参数有木有办法做出来?
      

  3.   

    是别人说要我原先写的上面为何没用到第三个参数,而且end为空格不好些吗?我一头的包啊