{ $ch = curl_init(); $headers = array('User-Agent: request', 'Content-Type: text/xml', 'Content-length: ' . strlen($postvar)); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLINFO_HEADER_OUT, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POSTFIELDS, $postvar); $res = curl_exec($ch); curl_close($ch); return $res; } $res = postUrl('http://blogsearch.google.com/ping/RPC2', $googleXML); //下面是返回成功与否的判断(根据谷歌ping的接口说明) if (strpos($res, "<boolean>0</boolean>")) { echo "PING Google 成功 "; } else { echo "PING Google 失败 "; } echo $res; $res = postUrl('http://ping.baidu.com/ping/RPC2', $baiduXML); //下面是返回成功与否的判断(根据百度ping的接口说明) if (strpos($res, "<int>0</int>")) { echo "PING Baidu 成功 "; } else { echo "PING Baidu 失败 "; } echo $res;
echo "Clear cookie\n"; @unlink("{$username}.txt"); echo "Buka halaman awal\n"; $out = getUrl($baseURL); $html = str_get_html($out); foreach ($html->find('a.btn') as $row) { $sessionID = str_replace("/startpage/?", "", $row->href); break; } halaman_login: echo "Buka halaman login\n"; $url = $baseURL . "?sign_in=1&" . $sessionID; getUrl($url); proses_login: echo "Proses login\n"; postUrl($baseURL, "login={$username}&pass={$password}", $baseURL . "/?sign_in=1&{$sessionID}"); halaman_duel: echo "username : {$username}\n"; echo "Buka halaman duel\n"; $out = getUrl($baseURL . "/duel"); if ($debug) { echo $out; } $html = str_get_html($out); foreach ($html->find('b') as $row) { $num = intval($row->plaintext); } echo "sisa petarungan : {$num}\n"; if ($num == 0) { goto end_duel; }