本文整理汇总了PHP中httpPost函数的典型用法代码示例。如果您正苦于以下问题:PHP httpPost函数的具体用法?PHP httpPost怎么用?PHP httpPost使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了httpPost函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: ip_wpcf7_mail_sent
function ip_wpcf7_mail_sent($wpcf7){
$submission = WPCF7_Submission::get_instance();
if ( $submission ) {
$formdata = $submission->get_posted_data();
$email = $formdata['your-email'];
$first_name = $formdata['your-first-name'];
$last_name = $formdata['your-last-name'];
$tel = $formdata['your-tel'];
$plan = $formdata['your-plan'];
}
$time = $today = date("F j, Y, g:i a");
// Open Agent:
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'http://ag.panda8.co/api?action=createAgentPph&creditAgent=1000&credit=100¤cy=USD&masterId=DEMVI&numOfUser=1&email='.$email.'&key=BBBAB3NzaC1yc2EAAAABJQAAAIEAhCdDMhGHdaw1uj9MH2xCB4jktwIgm4Al7S8rxvovMJBAuFKkMDd0vW5gpurUAB0PEPkxh6QFoBNazvio7Q03f90tSP9qpJMGwZid9hJEElplW8p43D3DdxXykLays2M8V2viYGLbiXvAbOECzwD4IaviOpylX0PaFznSR4ssXd0Int',
CURLOPT_USERAGENT => 'PPH186',
CURLOPT_FOLLOWLOCATION => 1,
));
$resp = curl_exec($curl);
$variables = json_decode($resp,true);
$agent = strtoupper($variables['agentId']);
$password = $variables['password'];
curl_close($curl);
// Send Info to bot
$text = urlencode("-- Sign up -- \n".$time."\n"."First Name: ".$first_name."\n"."Last Name: ".$last_name."\n"."Email: ".$email."\n"."Tel: ".$tel."\n"."Plan: ".$plan."\nAgent ID: ".$agent);
$curl = curl_init();
// Set some options - we are passing in a useragent too here
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'http://pph186.com/bot.php?key=b6fbc59dea1f5c41551f895886edbee5&msg='.$text.'&agent_id=sa',
CURLOPT_USERAGENT => 'PPH186'
));
// Send the request & save response to $resp
$resp = curl_exec($curl);
// Close request to clear up some resources
curl_close($curl);
$params = array(
"first_name" => $first_name,
"last_name" => $last_name,
"phone_mobile" => $tel,
"email1" => $email,
"account_name" => $agent,
"account_description" => $plan,
"campaign_id" => "c78e72d1-bfaa-b060-be8e-56cb258c33e6",
"assigned_user_id" => "1",
);
echo httpPost("http://crm.pph186.com/index.php?entryPoint=WebToLeadCapture",$params);
$_SESSION["first_name"] = $first_name;
$_SESSION["last_name"] = $last_name;
$_SESSION["account_name"] = $agent;
}
开发者ID:kyborg,项目名称:OneBet-Skin,代码行数:54,代码来源:contact_fỏm.php
示例2: getPushResult
function getPushResult($url, $appKey, $masterSecret, $taskId)
{
$params = array();
$params["action"] = "getPushMsgResult";
$params["appkey"] = $appKey;
$params["taskId"] = $taskId;
$sign = createSign($params, $masterSecret);
$params["sign"] = $sign;
$data = json_encode($params);
$result = httpPost($url, $data);
return $result;
}
开发者ID:imikay,项目名称:igetui,代码行数:12,代码来源:GetTaskCountResultDemo.php
示例3: downloadHeadImg
/**
* 下载图像
*/
public function downloadHeadImg()
{
ignore_user_abort(true);
set_time_limit(0);
for ($i = 100; $i > 0; $i++) {
$rt = $this->table('task_headimgdownload')->where(array('status' => 0))->get();
if (!$rt) {
$this->setTimeOut($i);
continue;
}
$tempPath = '../TempImg/';
$path = 'img/headImg/';
foreach ($rt as $a) {
//先验证是否已更换图片
$user = $this->table('user')->where(array('id' => $a['user_id']))->get(array('photo'), true);
if ($user['photo'] != $a['photo']) {
$status = 3;
} else {
$img = httpGet($a['photo']);
$fileName = time() . rand(10000, 99999) . '.jpg';
$save = file_put_contents($tempPath . $fileName, $img);
if ($save) {
$uploadStatus = true;
$image = new \System\lib\Image\Image($tempPath . $fileName);
$fileName2 = str_replace('.jpg', '_150.jpg', $fileName);
$image->thumb(200, 10000)->save($tempPath . $fileName2);
$status = 1;
//上传到图片服务器
$upload = httpPost($this->config('IMG_UPLOAD'), ['file' => new \CURLFile(realpath($tempPath . $fileName)), 'savePath' => $path, 'saveName' => basename($tempPath . $fileName)], true);
$upload = json_decode($upload, true);
if (!($upload && $upload['result'] == true)) {
$uploadStatus = false;
}
//上传压缩图
$upload2 = httpPost($this->config('IMG_UPLOAD'), ['file' => new \CURLFile(realpath($tempPath . $fileName2)), 'savePath' => $path, 'saveName' => basename($tempPath . $fileName2)], true);
$upload2 = json_decode($upload, true);
if (!($upload2 && $upload2['result'] == true)) {
$uploadStatus = false;
}
if ($uploadStatus == false) {
$status = 2;
} else {
$up2 = $this->table('user')->where(['id' => $a['user_id']])->update(['photo' => '/', $path . $fileName, 'photo_150' => '/', $path . $fileName2]);
$status = 1;
}
} else {
$status = 2;
}
}
$up = $this->table('task_headimgdownload')->where(['id' => $a['id']])->update(array('status' => $status, 'execute_time' => time()));
}
}
}
开发者ID:phpchen,项目名称:yiyuangou,代码行数:56,代码来源:IndexController.class.php
示例4: _getTicket
private function _getTicket()
{
/**
* ticket要进行缓存
*/
//获取ticket,由action_name来决定是临时的还是永久的
$ticket_url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token={$this->access_token}";
$scene = array($this->_sceneKey() => $this->scene_param);
$param = array("action_name" => $this->action_name, "action_info" => array("scene" => $scene));
if ($this->action_type == 1) {
$param['expire_seconds'] = 604800;
}
$ticket_return = httpPost($ticket_url, json_encode($param));
return $ticket_return;
}
开发者ID:Aylchen,项目名称:Admin,代码行数:15,代码来源:QrCode.php
示例5: runAll
function runAll()
{
global $servers;
file_put_contents('var/locales', json_encode(array_keys($servers)));
foreach ($servers as $locale => $server) {
$account = 'royalAdmin';
$pass = 'royalPass';
if (!empty($server['account'])) {
$account = $server['account'];
$pass = $server['pass'];
}
httpPost($server['login_url'], array('account' => $account, 'password' => $pass, 'submit' => true));
$dashboard = httpGet($server['dashboard_url'], array());
preg_match('/var statisDatas = ([^;]*);/sim', $dashboard, $data);
$dataArray = json_decode($data[1], true);
handleData($locale, $dataArray);
}
}
开发者ID:xinghuwang,项目名称:toolbox,代码行数:18,代码来源:fetch.php
示例6: registerAchievements
public static function registerAchievements()
{
global $achievements, $appID, $appName, $appURL;
$appToken = findAppToken();
$results = array();
// Read the graph to find out what's already associated with the app
$current = json_decode(file_get_contents("https://graph.facebook.com/{$appID}/achievements&access_token={$appToken}"), true);
$current = $current['data'];
$registered = array();
foreach ($current as $a) {
$registered[] = $a['url'];
}
foreach ($achievements as $name => $details) {
$achURL = "http:{$appURL}?" . "f=ra&n={$name}";
if (in_array($achURL, $registered)) {
continue;
}
$order = $details['display_order'];
// Write to the graph if any achievements have been added or changed
$results[$achURL] = httpPost("https://graph.facebook.com/{$appID}/achievements", array('access_token' => $appToken, 'achievement' => $achURL, 'display_order' => $order));
}
return array('had' => array_fill_keys($registered, true), 'added' => $results);
}
开发者ID:Avatarchik,项目名称:web-agarman,代码行数:23,代码来源:Achievements.php
示例7: httpPost
/**
* HTTP[s] POST request
*
* @author Robin Gareus <[email protected]>
* @param $host: hostname ; eg 'example.org'
* @param $path: request' eg '/index.php?id=123'
* @param $data_to_send : data to POST after the HTTP header.
* @param $opts various transport layer options (ssl, port, cert,..)
* @param $auth optional username, password and type ('basic', 'nodigest')
* @param $head custom http header
*
* if $opts is an empty array() a standard HTTP to port 80 request is performed.
*
* set auth['type']='basic' to use plain-text auth,
* digest-auth will be handled automatically if $auth['username'] is set and a 401
* status is encountered. - use auth['type']='nodigest' to override.
*
*/
function httpPost($host, $path, $data_to_send, $opts = array('cert' => "", 'transport' => 'ssl://', 'port' => 443, 'headers' => 0), $auth = array('username' => "", 'password' => "", 'type' => ""), $head = array('Content-type' => 'text/xml'))
{
$transport = '';
$port = 80;
if (!empty($opts['transport'])) {
$transport = $opts['transport'];
}
if (!empty($opts['port'])) {
$port = $opts['port'];
}
$remote = $transport . $host . ':' . $port;
$context = stream_context_create();
$result = stream_context_set_option($context, 'ssl', 'verify_host', true);
if (!empty($opts['cert'])) {
$result = stream_context_set_option($context, 'ssl', 'cafile', $opts['cert']);
$result = stream_context_set_option($context, 'ssl', 'verify_peer', true);
} else {
$result = stream_context_set_option($context, 'ssl', 'allow_self_signed', true);
}
$fp = stream_socket_client($remote, $err, $errstr, 60, STREAM_CLIENT_CONNECT, $context);
if (!$fp) {
trigger_error('httpPost error: ' . $errstr);
return NULL;
}
$req = '';
$req .= "POST {$path} HTTP/1.1\r\n";
$req .= "Host: {$host}\r\n";
if ($auth['type'] == 'basic' && !empty($auth['username'])) {
$req .= "Authorization: Basic ";
$req .= base64_encode($auth['username'] . ':' . $auth['password']) . "\r\n";
} elseif ($auth['type'] == 'digest' && !empty($auth['username'])) {
$req .= 'Authorization: Digest ';
foreach ($auth as $k => $v) {
if (empty($k) || empty($v)) {
continue;
}
if ($k == 'password') {
continue;
}
$req .= $k . '="' . $v . '", ';
}
$req .= "\r\n";
}
foreach ($head as $k => $v) {
$req .= $k . ': ' . $v . "\r\n";
}
if (empty($head['Content-type'])) {
$ct = 'text/xml';
$req .= "Content-type: {$ct}\r\n";
}
$req .= 'Content-length: ' . strlen($data_to_send) . "\r\n";
$req .= "Connection: close\r\n\r\n";
fputs($fp, $req);
fputs($fp, $data_to_send);
while (!feof($fp)) {
$res .= fgets($fp, 128);
}
fclose($fp);
if ($auth['type'] != 'nodigest' && !empty($auth['username']) && $auth['type'] != 'digest' && preg_match("/^HTTP\\/[0-9\\.]* 401 /", $res)) {
if (1 == preg_match("/WWW-Authenticate: Digest ([^\n\r]*)\r\n/Us", $res, $matches)) {
foreach (split(",", $matches[1]) as $i) {
$ii = split("=", trim($i), 2);
if (!empty($ii[1]) && !empty($ii[0])) {
$auth[$ii[0]] = preg_replace("/^\"/", '', preg_replace("/\"\$/", '', $ii[1]));
}
}
$auth['type'] = 'digest';
$auth['uri'] = 'https://' . $host . $path;
$auth['cnonce'] = $this->_randomNonce();
$auth['nc'] = 1;
$a1 = md5($auth['username'] . ':' . $auth['realm'] . ':' . $auth['password']);
$a2 = md5('POST' . ':' . $auth['uri']);
$auth['response'] = md5($a1 . ':' . $auth['nonce'] . ':' . $auth['nc'] . ':' . $auth['cnonce'] . ':' . $auth['qop'] . ':' . $a2);
return httpPost($host, $path, $data_to_send, $opts, $auth, $head);
}
}
# end if DIGEST AUTH
if (1 != preg_match("/^HTTP\\/[0-9\\.]* ([0-9]{3}) ([^\r\n]*)/", $res, $matches)) {
trigger_error('httpPost: invalid HTTP reply.');
return NULL;
}
if (1 != preg_match("/^2[0-9]{2}\$/", $matches[1])) {
//.........这里部分代码省略.........
开发者ID:x42,项目名称:dokurpcpub,代码行数:101,代码来源:action.php
示例8: loadTaskDefinition
function loadTaskDefinition($task)
{
$task = preg_replace('[^a-z0-9-]', '', $task);
$task = str_replace('-', '_', $task);
$fn = 'task_' . $task;
if (!function_exists($fn)) {
$taskSource = httpPost(DISPATCHER_URL, array('action' => 'tasksource', 'task' => $task));
if ($taskSource && $taskSource != '404') {
$taskSource = preg_replace('/^(<\\?(php)?)?(.*)(\\?>)?$/m', '$3', $taskSource);
echo "TaskSource: {$taskSource}\n";
// Checks for syntax errors
if (@eval('return true; ' . $taskSource)) {
//eval($taskSource);
if (function_exists($fn)) {
return $fn;
}
echo "ERR: Missing function definition for {$fn}\n";
return false;
}
echo "ERR: Synatx error for task '{$task}'\n";
}
return false;
}
return $fn;
}
开发者ID:jdsharp,项目名称:php-dispatcher,代码行数:25,代码来源:run-agent.php
示例9: array
<?php
/**
* Test Send message
*
* @author zendzhang<[email protected]>
* @version $Id$
*/
$data = array('queuename' => 'Demo', 'queuedata' => 'act=add&id=100');
$result = json_decode(httpPost('localhost', '/SendMessage.php', $data), true);
if (false === $result) {
echo "Request failure!\n";
} else {
if (isset($result['status']) && $result['status'] == 1) {
echo "Send message successful!\n";
} else {
echo "Send message failure,error:{$result['data']}\n";
}
}
/////////////////////////////////////////////////////////////////////
/**
* HTTP post request
*
* @param string $host
* @param string $url
* @param sting $data
* @param int $port
* @param init $timeout
* @return mixed
*/
function httpPost($host, $url, $data, $port = 80, $timeout = 10)
开发者ID:laiello,项目名称:truelegend,代码行数:31,代码来源:Test.php
示例10: array
<?php
require 'config.php';
$dados = array('categoria' => 'Entretenimento');
$url = 'http://127.0.0.1/webservices/api-blog/json/categoria-cadastrar.php';
$r = httpPost($dados, $url);
$dados = json_decode($r, true);
print_r($dados);
开发者ID:JoaoAntonioMaruti,项目名称:AulasUnipar2015,代码行数:8,代码来源:cadastrar-categoria.php
示例11: get_rate
public function get_rate()
{
header('Content-Type: application/xml');
$origin = $this->input->post('origin');
$destination = $this->input->post('destination');
//get the items
$items = json_decode($_REQUEST["items"]);
$item = '';
for ($i = 0; $i < count($items); $i++) {
$sq = $i + 1;
$item .= '<Item sequence="' . $sq . '" freightClass="' . $items[$i]->class . '">';
$item .= '<Weight units="' . $items[$i]->weight_unit . '">' . $items[$i]->weight . '</Weight>';
$item .= '<Quantity units="' . $items[$i]->quantity_unit . '">' . $items[$i]->quantity . '</Quantity>';
$item .= '</Item>';
}
//if ($request["origin"] == "" || $request["destination"] == "" || $request["pieces"] == "" || $request["weight"] == "" || $request["commodity"] == "" || $request["height"] == "" || $request["width"] == "" || $request["lenght"] == "") {
// $request["origin"] = "60606";
// $request["destination"] = "33133";
// $request["pieces"] = "1";
// $request["weight"] = "400";
// $request["commodity"] = "100";
// $request["lenght"] = "20";
// $request["width"] = "400";
// $request["height"] = "20";
//
//}
function httpPost($url, $params)
{
$postData = '';
//create name value pairs seperated by &
foreach ($params as $k => $v) {
$postData .= $k . '=' . $v . '&';
}
rtrim($postData, '&');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POST, count($postData));
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
$peticion = '<service-request>
<!-- Consult the WSDocumentation .doc file section 2.1.1 for more details on these values. -->
<service-id>XMLRating</service-id>
<!-- Supply a unique request-id to improve traceability & diagnostics -->
<request-id>20150302-MG-Test-ABC</request-id>
<data>
<RateRequest>
<ReturnAssociatedCarrierPricesheet>true</ReturnAssociatedCarrierPricesheet>
<!-- RatingLevel: Specify the company level at which the rating will perform. The company is either defined by name or account number. -->
<!-- Enterprise Customer Acct Number: -->
<RatingLevel isCompanyAccountNumber="true"/>
<Constraints>
<!-- <Carrier name="" scac=""/> is optional; either name or scac attribute must be set (not both) value if specified -->
<Mode/>
<ServiceFlags/>
<Equipments/>
<!-- All constraints are optional;
<ServiceFlags>
<ServiceFlag code=""/>
</ServiceFlags>
<Equipments>
<Equipment code=""/>
</Equipments>
-->
<!-- <Contract type="" name=""/> is optional; Type must have value if specified -->
<!-- All constraints are optional;
<ContractService/>
<PaymentTerms/>
-->
</Constraints>
<Items>
' . $item . '
</Items>
<Events>
<Event sequence="1" type="Pickup" date="12/15/2015 16:20">
<Location>
<Zip>' . $origin . '</Zip>
<Country>USA</Country>
</Location>
</Event>
<Event sequence="2" type="Drop" date="12/19/2015 16:22">
<Location>
<Zip>' . $destination . '</Zip>
<Country>USA</Country>
</Location>
</Event>
</Events>
<!-- <LinearFeet/> is optional; must have value if specified -->
<!-- <RatingCount/> is optional; must have value if specified -->
<ReferenceNumbers>
<ReferenceNumber type=""/>
</ReferenceNumbers>
<!-- <MaxPriceSheets/> is optional; must have value if specified -->
<ShowInsurance>false</ShowInsurance>
</RateRequest>
</data>
//.........这里部分代码省略.........
开发者ID:nandoIII,项目名称:ltl-freight-rates,代码行数:101,代码来源:Home.php
示例12: setFlash
<?php
include 'include.php';
if (!isset($_GET['id'])) {
setFlash("action impossible.", "danger");
redirect("accueil.php");
die;
}
$user = $_SESSION['profil']['id'];
$post = $_GET['id'];
$fields = ['content' => $_POST['content'], 'user_id' => urlencode($user), 'post_id' => urlencode($post)];
$url = 'http://api-rest-youcef-m.c9.io/comment/new';
$result = httpPost($fields, $url);
$result;
if ($result['code'] == 400) {
setFlash("action impossible.", "danger");
redirect('afficherphoto.php?id=' . $post);
} elseif ($result['code'] == 200) {
$user = json_decode($result['content']);
foreach ($user as $k => $v) {
$_SESSION['profil'][$k] = $v;
}
setFlash('Votre commentaire a bien été envoyé');
redirect('afficherphoto.php?id=' . $post);
} else {
setFlash('Nos services sont en panne, nous faisons notre possible pour régler le problème.', 'danger');
redirect('index.php');
}
开发者ID:Reval63,项目名称:projet_photo,代码行数:28,代码来源:comment.php
示例13: substr
}
if ($inheader == 0) {
echo $resp_str;
}
}
echo $resp_str;
echo "\r\n";
if ($nMaxReturn == 0) {
$_SESSION["session_id"] = substr($resp_str, strpos($resp_str, "Set-Cookie: ") + 12, 45);
//echo $_SESSION["session_id"];
if (substr($resp_str, strpos($resp_str, "<ErrorNum>") + 10, strpos($resp_str, "</ErrorNum>") - strpos($resp_str, "<ErrorNum>") - 10) == 0) {
$_SESSION["activeid"] = substr($resp_str, strpos($resp_str, "<ActiveID>") + 10, strpos($resp_str, "</ActiveID>") - strpos($resp_str, "<ActiveID>") - 10);
}
} else {
if (substr($resp_str, strpos($resp_str, "<ErrorNum>") + 10, strpos($resp_str, "</ErrorNum>") - strpos($resp_str, "<ErrorNum>") - 10) == 0) {
echo "\r\n";
echo "操作成功";
} else {
echo "\r\n";
echo substr($resp_str, strpos($resp_str, "<ErrorNum>") + 10, strpos($resp_str, "</ErrorNum>") - strpos($resp_str, "<ErrorNum>") - 10);
//处理返回值.
$_SESSION["ReturnString"] = substr($resp_str, strpos($resp_str, "<ErrorNum>") + 10, strpos($resp_str, "</ErrorNum>") - strpos($resp_str, "<ErrorNum>") - 10);
}
}
fclose($fp);
}
httpPost("/LANZGateway/Login.asp", "UserID=968888&Account=12244kk&Password=321321", "", 0);
httpPost("/LANZGateway/SendSMS.asp", "SMSType=1&Phone=13600000&Content=PHP\r\n接口测试demo调试&ActiveID=" . $_SESSION["activeid"], $_SESSION["session_id"], 1);
httpPost("/LANZGateway/Logoff.asp", "ActiveID=" . $_SESSION["activeid"], $_SESSION["session_id"], 2);
?>
开发者ID:dalinhuang,项目名称:urWq,代码行数:30,代码来源:lanzSMS.php
示例14: curl_setopt
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//execute post
$result = curl_exec($ch);
#print_r($result);
curl_close($ch);
return $result;
}
$input = '10 8';
$code = $_REQUEST['code'];
//print
$url = 'http://api.hackerrank.com/checker/submission.json';
$key = 'hackerrank|631865-613|616ab1ad542ca4dbeabd7f04e266006c5c5a14f3';
$query = array();
$query['source'] = urlencode($code);
$query['testcases'] = urlencode(json_encode(array($input)));
$query['lang'] = 5;
$query['api_key'] = urlencode($key);
$q = array();
$fields_string = "";
foreach ($query as $key => $value) {
$fields_string .= $key . '=' . $value . '&';
}
rtrim($fields_string, '&');
$result = "";
$result = httpPost($url, $q, $fields_string);
//print_r($result);
$result = json_decode($result, true);
//print_r($result['result']['stdout']);
echo $result['result']['stdout'][0];
开发者ID:archit09jain,项目名称:intreviewprep.com,代码行数:31,代码来源:hackerApi.php
示例15: array
case 2:
//HTTP
echo "Sent HTTP\r\n";
$data = array();
$data["to_address"] = $address;
$data["amount"] = $value;
$data["btc_amount"] = $btc;
$data["confirmations"] = $confirmations;
$data["txhash"] = $txhash;
$data["block"] = -1;
$data["signature"] = sha1( $address . $value . $confirmations . $txhash . $currentheight . $user->secret );
if(filter_var($user->url, FILTER_VALIDATE_URL) !== FALSE && $user->url != "")
{
$result = httpPost($user->url, $data);
if ($result === FALSE)
$success = false;
else
$success = true;
} else {
mail(SYS_ADMIN, "URL in monitor bad", "Skipping http attempt for ".$user->url, "FROM: [email protected]");
}
break;
case 3:
//Pubnub
$data = array();
$data["to_address"] = $address;
$data["amount"] = $value;
开发者ID:neofutur,项目名称:BitPing.Net,代码行数:30,代码来源:unconfirmed-monitor.php
示例16: getWechatMedia
/**
* 获取微信media并保存
* @param str $mediaID media_id
* @param str $path 目录
* @return bool
*/
public static function getWechatMedia($mediaID, $savePath = null)
{
if (empty($savePath)) {
$savePath = 'order/' . time() . '_' . rand(1000, 9999) . ".jpg";
}
$weObj = new \System\lib\Wechat\Wechat(\System\Entrance::config("WEIXIN_CONFIG"));
$media = $weObj->getMedia($mediaID);
if (!$media) {
return false;
}
$temPath = '../TempImg/';
//临时保存路径
if (!dirExists($temPath)) {
return false;
}
$fileName = basename($savePath);
/* $fileName=basename($savePath);
$checkPath=str_replace($fileName, '', $savePath);
if(!dirExists($checkPath)) return false; */
if (!file_put_contents($temPath . $fileName, $media)) {
return false;
}
//生成压缩图片
$image = new \System\lib\Image\Image($temPath . $fileName);
$img1 = $image->size();
$return['img1']['path'] = $temPath . $fileName;
$return['img1']['width'] = $img1[0];
$return['img1']['heigh'] = $img1[1];
//200*200缩略图
$img2Path = $temPath . str_replace('.', '_thumb200.', $fileName);
$image->thumb(200, 10000)->save($img2Path);
$img2 = $image->size();
$return['img2']['path'] = $img2Path;
$return['img2']['width'] = $img2[0];
$return['img2']['heigh'] = $img2[1];
//360*360缩略图
$img3Path = $temPath . str_replace('.', '_thumb360.', $fileName);
$image->open($temPath . $fileName);
$image->thumb(360, 10000)->save($img3Path);
$img3 = $image->size();
$return['img3']['path'] = $img3Path;
$return['img3']['width'] = $img3[0];
$return['img3']['heigh'] = $img3[1];
//dump($return);
//上传
foreach ($return as $key => $a) {
$upload = httpPost(\System\Entrance::config('IMG_UPLOAD'), ['file' => new \CURLFile(realpath($a['path'])), 'savePath' => dirname($savePath) . '/', 'saveName' => basename($a['path'])], true);
//dump($upload);
$upload = json_decode($upload, true);
if (!($upload && $upload['result'] == true)) {
return false;
}
unlink($a['path']);
$return[$key]['path'] = $upload['path'];
}
return $return;
}
开发者ID:phpchen,项目名称:yiyuangou,代码行数:63,代码来源:AppTools.class.php
示例17: substr
if ($inheader && ($resp_str == "\n" || $resp_str == "\r\n")) {
$inheader = 0;
}
if ($inheader == 0) {
echo $resp_str;
}
}
echo $resp_str;
echo "\r\n";
if ($nMaxReturn == 0) {
$_SESSION["session_id"] = substr($resp_str, strpos($resp_str, "Set-Cookie: ") + 12, 45);
//echo $_SESSION["session_id"];
if (substr($resp_str, strpos($resp_str, "<ErrorNum>") + 10, strpos($resp_str, "</ErrorNum>") - strpos($resp_str, "<ErrorNum>") - 10) == 0) {
$_SESSION["activeid"] = substr($resp_str, strpos($resp_str, "<ActiveID>") + 10, strpos($resp_str, "</ActiveID>") - strpos($resp_str, "<ActiveID>") - 10);
}
} else {
if (substr($resp_str, strpos($resp_str, "<ErrorNum>") + 10, strpos($resp_str, "</ErrorNum>") - strpos($resp_str, "<ErrorNum>") - 10) == 0) {
echo "\r\n";
echo "操作成功";
} else {
echo "\r\n";
echo substr($resp_str, strpos($resp_str, "<ErrorNum>") + 10, strpos($resp_str, "</ErrorNum>") - strpos($resp_str, "<ErrorNum>") - 10);
//处理返回值.
$_SESSION["ReturnString"] = substr($resp_str, strpos($resp_str, "<ErrorNum>") + 10, strpos($resp_str, "</ErrorNum>") - strpos($resp_str, "<ErrorNum>") - 10);
}
}
fclose($fp);
}
httpPost("/LANZGateway/DirectSendSMSs.asp", "UserID=1234569&Account=123456&Password=56EAF4A2C651BFF3D77236A4E3FE16E44C48EA39&SMSType=1&Phones=1111111111&Content=gfdsa&SendDate=&Sendtime=", "", 1);
?>
开发者ID:dalinhuang,项目名称:urWq,代码行数:30,代码来源:lanzSMSDirectSendSMSs.php
示例18: paypal_notify
public function paypal_notify()
{
// $data="mc_gross=25.00&invoice=18&protection_eligibility=Eligible&address_status=confirmed&payer_id=SXZZVBRD9D4JJ&tax=0.00&address_street=1+Main+St&payment_date=05%3A23%3A07+Mar+01%2C+2015+PST&payment_status=Completed&charset=windows-1252&address_zip=95131&first_name=test&mc_fee=1.03&address_country_code=US&address_name=test+buyer¬ify_version=3.8&custom=&payer_status=verified&business=sunxguo-facilitator%40163.com&address_country=United+States&address_city=San+Jose&quantity=1&verify_sign=ACkCvEsJvmOecWFvZsZ4A2g5Nt9MApZMHtotk5..k3ZcBn3q0UA7WuLa&payer_email=sunxguo-buyer%40163.com&txn_id=1VL90883LX3271452&payment_type=instant&last_name=buyer&address_state=CA&receiver_email=sunxguo-facilitator%40163.com&payment_fee=1.03&receiver_id=XX2RXQZAHTW58&txn_type=web_accept&item_name=iphone6+plus+64G%26&mc_currency=USD&item_number=&residence_country=US&test_ipn=1&handling_amount=0.00&transaction_subject=iphone6+plus+64G%26&payment_gross=25.00&shipping=0.00&ipn_track_id=e5af3dcbf778";
$data = file_get_contents("php://input");
$notify = $this->convert_input_data($data);
// 由于这个文件只有被Paypal的服务器访问,所以无需考虑做什么页面什么的,
// 这个页面不是给人看的,是给机器看的
$order_id = (int) $notify['invoice'];
$order = $this->dbHandler->selectPartData('order', 'id_order', $order_id);
$order = $order[0];
$app = $this->dbHandler->selectPartData('app', 'id_app', $order->appid_order);
$app = $app[0];
$merchant = $this->dbHandler->selectPartData('merchant', 'id_merchant', $app->merchant_id_app);
$merchant = $merchant[0];
// 由于该URL不仅仅只有Paypal的服务器能访问,其他任何服务器都可以向该方法发起请求。
// 所以要判断请求发起的合法性,也就是要判断请求是否是paypal官方服务器发起的
// 拼凑 post 请求数据
$notify["cmd"] = "_notify-validate";
$url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
$res = httpPost($url, $notify);
if ($res && !empty($order)) {
// 本次请求是否由Paypal官方的服务器发出的请求
if (strcmp($res, 'VERIFIED') == 0) {
/**
* 判断订单的状态
* 判断订单的收款人
* 判断订单金额
* 判断货币类型
*/
if ($notify['payment_status'] != 'Completed' or $notify['receiver_email'] != $merchant->paypal_merchant or 'USD' != $notify['mc_currency']) {
// 如果有任意一项成立,则终止执行。由于是给机器看的,所以不用考虑什么页面。直接输出即可
exit('fail');
} else {
// 如果验证通过,则证明本次请求是合法的
$this->email($merchant->email_merchant, 'Success', "订单:" . $order->num_order . "支付成功");
$this->dbHandler->updatedata("order", array("state_order" => 1), "id_order", $order_id);
exit('success');
}
} else {
exit('fail');
}
} else {
exit('No data');
}
}
开发者ID:sunxguo,项目名称:platform,代码行数:45,代码来源:home.php
示例19: httpPost
<?php
function httpPost($url, $params)
{
$postData = http_build_query($params);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POST, count($postData));
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
$docName = isset($_GET['doc_name']) ? $_GET['doc_name'] : 'xda';
$htmlContent = file_get_contents('mine.html');
$params = array('html_content' => $htmlContent, 'doc_name' => $docName);
echo httpPost("http://localhost/toword_by_PhpWord/PHPWord-develop/samples/DocxApi.php", $params);
开发者ID:var23rav,项目名称:toword_by_PhpWord,代码行数:19,代码来源:CallDocxApi.php
示例20: twitchGetAccessToken
function twitchGetAccessToken($code)
{
$paramsTwitch = array('client_id' => TWITCH_CLIENT_ID, 'client_secret' => TWITCH_CLIENT_SECRET, 'grant_type' => "authorization_code", 'redirect_uri' => TWITCH_REDIRECT_URI, 'code' => $code);
$loginResponse = httpPost("https://api.twitch.tv/kraken/oauth2/token", $paramsTwitch);
return json_decode($loginResponse);
}
开发者ID:carriercomm,项目名称:coebot-www,代码行数:6,代码来源:common.php
注:本文中的httpPost函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论