I wanted to buy the Xiaomi Mi 3 telecom version today, but it was sold out every time it was shipped, so I did a simple check to see if it was in stock.
Then I successfully grabbed the white telecom version of Xiaomi Mi 3 today.
The arrays inside are for different versions. I only want the telecom version, so I wrote down three simple judgments
-
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL, "http://www.mi.com/buyphone/mi3");
- curl_setopt($curl, CURLOPT_HEADER, 0 );
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
- $data = curl_exec($curl);
- curl_close($curl);
- preg_match_all("/isLack:(.*),/",$data,$out );
- if($out[1][24]=='false'){
- mail("admin@qq.com","Xiaomi 3 black telecom version is in stock","Purchase address http://order .mi.com/event/selectPacket/goodsid/2140800022");
- }else{
- echo "Wait";
- }
-
- if($out[1][23]=='false'){
- mail(" admin@qq.com","Xiaomi 3 white telecom version is in stock","Purchase address http://order.mi.com/event/selectPacket/goodsid/2141000021");
- }else{
- echo "Wait" ;
- }
-
- if($out[1][25]=='false'){
- echo "Buy";
- mail("admin@qq.com","Xiaomi 3 Silver Telecom Edition is in stock", "Purchase address http://order.mi.com/event/selectPacket/goodsid/2141300016");
- }else{
- echo "Wait";
- }
Copy code
|