我应该从这个网站获得价格,这里我正在使用PHP正则表达式和cUrl。
网址=' http://www.shopclues.com/lenovo-a526-with-1-year-physical-liquid-damage-cover-plus-insurance-refurbished.html';
$shopclues = get_page($url);
if(preg_match('#<div class="price"><label>Deal Price:</label>(.*?)<\/div>#is', $shopclues,$b)) {
$data['price'] = (float) str_replace(array(','),'',$b[1]);
}
elseif(preg_match('#<span id="sec_discounted_price_5713954">(.*?)<\/span><\/div>#is', $shopclues,$a))
{
$data['price'] = (float) str_replace(array(','),'',$a[1]);
}
答案 0 :(得分:-1)
由此行解决
$data['price'] = (float) str_replace(array('Rs.', ','),'',$b[1]);