Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header("Content-Type:text/html;charset=UTF-8");
- function get_curl_contents($url) {
- $user_agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36";
- $referer = "http://item.jd.com/986323.html#none/";
- $ch = curl_init();
- $timeout = 30;
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_REFERER, $referer);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
- curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
- $data = curl_exec($ch);
- curl_close($ch);
- return $data;
- }
- $url = 'http://st.3.cn/gds.html?callback=getStockCallback&skuid=7FE79285FC5FF87B3BD5E7A34C6FFCC1&provinceid=21&cityid=1898&areaid=1907&townid=0&sortid1=670&sortid2=677&sortid3=679';
- $content=get_curl_contents($url);
- //echo $content;
- preg_match("|StockStateName\":\"([\s\S]*?)\"|",$content,$data);
- $datas = iconv('GBK', 'UTF-8', $data[1]);
- if($datas == "有货")
- {
- curl_setopt_array($ch = curl_init(), array(
- CURLOPT_URL => "https://api.pushover.net/1/messages.json",
- CURLOPT_POSTFIELDS => array(
- "token" => "xxxxx",
- "user" => "xxxxxx",
- "message" => "270X 有货",
- )));
- curl_exec($ch);
- curl_close($ch);
- }
- //echo $pr[1];
- else{
- echo '<h1>还是没货 30 seconds later auto load !</h1>
- <head>
- <meta http-equiv="refresh" content="30;url=ffff.php">
- </head>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement