$fp = fopen("https://list.tmall.com/search_product.htm?q=hello kitty&sort=p&style=g&tmhkmain=0#J_Filter","r");
$tmall = stream_get_contents($fp, 1024*1024);
$tmall = urlencode($tmall);
$rule = '/class%3D%22product%22(.*)class%3D%22product%22/s';
preg_match($rule,$tmall,$result);
print_r($result);
exit;//打印不出来
$goods_p=urldecode($result[0]);
$rule_price='/<\/b>(.*)<\/em>/';
$rule_url = '/detail.tmall.com.*" /';
preg_match($rule_price,$goods_p,$price);
preg_match($rule_url,$goods_p,$url);
$url=explode('"', $url[0]);
echo $price[1].$url[0];
是匹配的规则出错了吗
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
小伙看你根骨奇佳,潜力无限,来学PHP伐。