本文整理汇总了PHP中http::setCookieJar方法的典型用法代码示例。如果您正苦于以下问题:PHP http::setCookieJar方法的具体用法?PHP http::setCookieJar怎么用?PHP http::setCookieJar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类http
的用法示例。
在下文中一共展示了http::setCookieJar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: connect
function connect()
{
http::setCookieJar('cookie.txt');
$this->homePage = http::get('http://mobile.bet365.com');
if ($this->homePage === FALSE || empty($this->homePage)) {
return FALSE;
}
$this->sessionId = $this->getPropData('sessionId');
if ($this->sessionId === NULL || empty($this->sessionId)) {
return FALSE;
}
echo "Session ID: " . $this->sessionId . "\n";
$this->powConnectionDetails = $this->getPropData('ConnectionDetails');
if ($this->powConnectionDetails === NULL || empty($this->powConnectionDetails)) {
return FALSE;
}
if (!isset($this->powConnectionDetails[0]) || !isset($this->powConnectionDetails[0]['Host'])) {
return FALSE;
}
echo "Pow HTTPS Host: {$this->powConnectionDetails[1]['Host']}:{$this->powConnectionDetails[1]['Port']}\n";
$this->clientRn = substr(str_shuffle("0123456789"), 0, 16);
echo "Pow Random Number: {$this->clientRn}\n";
$requestPow = $this->powRequest(0, array('method: 0', 'transporttimeout: 20', 'type: F', 'topic: S_' . $this->sessionId));
var_dump($requestPow);
if ($requestPow === FALSE || empty($requestPow)) {
return FALSE;
}
$data = explode($this->readItConstants['FIELD_DELIM'], $requestPow);
if (empty($data) || count($data) == 0 || count($data) == 1) {
return FALSE;
}
echo "Constant: {$data[0]}\n";
echo "Pow Session Id: {$data[1]}\n";
$this->clientId = $data[1];
$sslStatus = urlencode($this->powConnectionDetails[1]['Host'] . ':' . $this->powConnectionDetails[1]['Port']);
// Inform the main site of our connection
http::post('https://mobile.bet365.com/pushstatus/logpushstatus.ashx?state=true', 'sslStatus=' . $sslStatus . '&connectionID=' . $this->clientId . '&uid=' . $this->clientRn . '&connectionStatus=0&stk=' . $this->sessionId, array('X-Requested-With: XMLHttpRequest', 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8'));
$requestPow = $this->powRequest(2, array('method: 1'));
// Subscribe to the InPlay list
$this->subscribe('OVInPlay_1_3//');
$requestPow = $this->powRequest(2, array('method: 1'));
if (substr($requestPow, 0, 1) != "") {
echo "Unexpected InPlay packet header";
return FALSE;
}
// Here we have some soccer data!!! wow!!
$gameData = explode($this->readItConstants['RECORD_DELIM'], $requestPow);
$gameData = explode("|", $gameData[count($gameData) - 1]);
array_shift($gameData);
// "F"
$initialCL = $this->parameterizeLine($gameData[0]);
if ($initialCL === FALSE) {
return FALSE;
}
if ($initialCL['cmd'] != 'CL') {
return FALSE;
}
if ($initialCL['params']['NA'] != 'Soccer') {
return FALSE;
}
// It isn't soccer!!??
// I decided we don't need to know what damn league they're in, holy shit too much trouble
$events = array();
// skip the initial CL (soccer)
for ($i = 1; $i < count($gameData); $i++) {
$lineData = $this->parameterizeLine($gameData[$i]);
if ($lineData === FALSE) {
continue;
}
// "EV" == EVENT
// "CT" == COMPETITION_NAME
// "PA" == PARTICIPANT
// "MA" == MARKET
// "CL" == CLASSIFICATION
// "OR" == ORDER
if ($lineData['cmd'] == 'EV') {
//if($lineData['params']['ID'] != '1')
// continue;
array_push($events, $lineData['params']);
} elseif ($lineData['cmd'] == 'CT') {
if ($lineData['params']['NA'] == 'Coupons') {
break;
// It adds some kind of coupon stuff... what
}
} elseif ($lineData['cmd'] == 'CL') {
break;
// This isn't soccer m8
}
}
$requestPow = $this->powRequest(2, array('method: 1'));
echo "Trying for ID: {$events[0]['ID']}\n";
$this->unsubscribe('OVInPlay_1_3//');
// It basically logs the data from the first soccer match found, if you want other matches loop through the array
$soccerEvent = $this->getSoccerEventInformation($events[0]['ID']);
var_dump($soccerEvent);
return FALSE;
}