Php wamp osCommerce易趣模块出现功能eregi故障

Php wamp osCommerce易趣模块出现功能eregi故障,php,wamp,ebay-api,oscommerce,Php,Wamp,Ebay Api,Oscommerce,我目前正在尝试获取用于OS commerce的eBay拍卖模块,但发现eregi功能已被弃用。我搜索了好几篇帖子,但答案都没有用。我对php了解不多,但由于作业的性质,我不得不继续下去 我显然有问题的代码是: $URL = 'http://cgi6.ebay.com/ws/eBayISAPI.dll?ViewListedItems&userid=' . EBAY_USERID . '&include=0&since=' . AUCTION_ENDED .

我目前正在尝试获取用于OS commerce的eBay拍卖模块,但发现eregi功能已被弃用。我搜索了好几篇帖子,但答案都没有用。我对php了解不多,但由于作业的性质,我不得不继续下去

我显然有问题的代码是:

        $URL = 'http://cgi6.ebay.com/ws/eBayISAPI.dll?ViewListedItems&userid=' . EBAY_USERID . '&include=0&since=' . AUCTION_ENDED . '&sort=' . AUCTION_SORT . '&rows=0'; 

// Where to Start grabbing and where to End grabbing
$GrabStart = '<tr bgcolor=\"#ffffff\">';
$GrabEnd = 'About eBay';

// Open the file
$file = fopen("$URL", "r");

// Read the file

if (!function_exists('file_get_contents')) {
     $r = fread($file, 80000);
} 
else {
    $r = file_get_contents($URL);  
}


// Grab just the contents we want
$stuff = eregi("$GrabStart(.*)$GrabEnd", $r, $content);
$URL='1!'http://cgi6.ebay.com/ws/eBayISAPI.dll?ViewListedItems&userid=' . EBAY\u用户ID。“&include=0&since='。拍卖会结束了&排序='。“你说得对。”&行=0';
//从何处开始抓取和从何处结束抓取
$GrabStart='';
$GrabEnd=‘关于易趣’;
//打开文件
$file=fopen(“$URL”,“r”);
//读文件
如果(!function_存在('file_get_contents')){
$r=fread($80000);
} 
否则{
$r=文件内容($URL);
}
//抓住我们想要的东西
$stuff=eregi($GrabStart(.*)$GrabEnd“,$r,$content);
----代码结束

我有一个类似的问题与分裂,但改变它爆炸解决了问题,现在与埃雷吉它不太工作与preg比赛或我没有使用它正确

谢谢你的关注

问候


胡安·费尔南多·贝尔德(Juan Fernando Baird)

我必须承认我对regex没有太大的兴趣,所以我尝试使用PHP5.2.9和5.2.6测试您现有的eregi,看看它返回了什么。它在$stuff中总是返回FALSE,$contents未设置为任何值。所以这段代码可能从来没有做过任何事情

所以这有点危险,因为我不能确切地确定代码实际上试图返回什么,即它是否希望$GrabStart和/或$GrabEnd出现在结果中

这可能会起作用。而且可能使用更少的资源,因为它不必为一个相当简单的文本操作加载正则表达式引擎

$r = 'aaa<tr bgcolor=\"#ffffff\">xxxAbout eBaybbb';
$conent = '';

$GrabStart = '<tr bgcolor=\"#ffffff\">';
$GrabEnd = 'About eBay';

/*
 *  This will return the GrabStart and GrabEnd data in the result
    p1 3
    p2 40
    $content = <tr bgcolor=\"#ffffff\">xxxAbout eBay
*/
$p1 = strpos($r, $GrabStart);
$p2 = strpos($r, $GrabEnd) + strlen($GrabEnd);
$content = substr($r, $p1, $p2-$p1);

echo 'p1 ' . $p1 . PHP_EOL;
echo 'p2 ' . $p2 . PHP_EOL;
echo $content . PHP_EOL;

/*
*  This will just return the data between GrabStart and GrabEnd and not the start and end sentinals
    p1 27
    p2 30
    $content = xxx
*/
$p1 = strpos($r, $GrabStart) + strlen($GrabStart);
$p2 = strpos($r, $GrabEnd, $p1);
$content = substr($r, $p1, $p2-$p1);

echo 'p1 ' . $p1 . PHP_EOL;
echo 'p2 ' . $p2 . PHP_EOL;
echo $content . PHP_EOL;
$r='aaaxxxAbout ebaybb';
$conent='';
$GrabStart='';
$GrabEnd=‘关于易趣’;
/*
*这将在结果中返回GrabStart和GrabEnd数据
p1 3
p2 40
$content=xxx关于易趣
*/
$p1=STRPO($r$GrabStart);
$p2=STRPO($r,$GrabEnd)+strlen($GrabEnd);
$content=substr($r,$p1,$p2-$p1);
回音“p1”$p1。PHP_EOL;
回声“p2”$p2。PHP_EOL;
echo$content。PHP_EOL;
/*
*这将只返回GrabStart和GrabEnd之间的数据,而不返回start和end Sentinal
p1 27
p2 30
$content=xxx
*/
$p1=STRPO($r,$GrabStart)+strlen($GrabStart);
$p2=STRPO($r、$GrabEnd、$p1);
$content=substr($r,$p1,$p2-$p1);
回音“p1”$p1。PHP_EOL;
回声“p2”$p2。PHP_EOL;
echo$content。PHP_EOL;

我希望这会有所帮助,尽管它可能会要求回答尽可能多的问题。

hmmm我应该替换张贴的代码吗?或者它需要更多的调整?正如我所说的,我对php不太熟悉,所以有点需要知道它是否需要其他东西。呵呵,如果这让你感到困扰,很抱歉,但是如果我需要调整它,调整什么,如果不需要,请告诉我。太棒了:Djust试过了,用我能想到的更简单的方法,但没用,我只是找到了eregi行并粘贴了你的代码。我知道这可能是愚蠢的,但实际上我从来没有在我的生活中使用过php,所以我有点迷失在这里