本文整理汇总了PHP中WP_Http::post方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Http::post方法的具体用法?PHP WP_Http::post怎么用?PHP WP_Http::post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WP_Http
的用法示例。
在下文中一共展示了WP_Http::post方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post_to_third_party
function post_to_third_party($entry, $form)
{
$post_url = 'http://thirdparty.com';
$body = array('first_name' => rgar($entry, '1.3'), 'last_name' => rgar($entry, '1.6'), 'message' => rgar($entry, '3'));
$request = new WP_Http();
$response = $request->post($post_url, array('body' => $body));
}
示例2: post_to_third_party
function post_to_third_party($entry, $form)
{
//echo '<pre>';print_r($entry);echo '</pre>';
$post_url = 'http://dmtrk.net/signup.ashx';
$body = array('Email' => $entry['1'], 'addressbookid' => '2619899', 'userid' => '88348', 'cd_FIRSTNAME' => $entry['2.3'], 'cd_LASTNAME' => $entry['2.6'], 'cd_FULLNAME' => $entry['2.3'] . ' ' . $entry['2.6']);
// echo '<pre>';print_r($body);echo '</pre>';
$request = new WP_Http();
$response = $request->post($post_url, array('body' => $body));
}
示例3: perform_post_payment_duties
function perform_post_payment_duties($order_id)
{
//create box folder
$folderName = $order_id;
$parentFolder = '1169288163';
$urltopost = 'http://www.paratus.com.au/wp-content/themes/goodchoice/includes/paratus-box-api/boxapi/example.php';
$body = array('action' => 'create_folder', 'folder_name' => $folderName, 'parent_folder' => $parentFolder);
$request = new WP_Http();
$response = $request->post($urltopost, array('body' => $body, 'blocking' => false));
}
示例4: verify_paypal_ipn
private function verify_paypal_ipn()
{
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&{$key}={$value}";
}
$url = rgpost('test_ipn') ? $this->sandbox_url : $this->production_url;
$this->log_debug(__METHOD__ . "(): Sending IPN request to PayPal for validation. URL: {$url} - Data: {$req}");
$url_info = parse_url($url);
//Post back to PayPal system to validate
$request = new WP_Http();
$headers = array('Host' => $url_info['host']);
$response = $request->post($url, array('httpversion' => '1.1', 'headers' => $headers, 'sslverify' => false, 'ssl' => true, 'body' => $req, 'timeout' => 20));
$this->log_debug(__METHOD__ . '(): Response: ' . print_r($response, true));
if (is_wp_error($response)) {
return $response;
}
return trim($response['body']) == 'VERIFIED';
}
示例5: post_item_data_to_server
function post_item_data_to_server($order_id, $orderItemId, $adviserEmail, $userID, $item, $billingAddressFormatted, $billingAddress, $billingName, $billingCompany, $billing_phone, $billingAddress1, $billingAddress2, $billingCity, $billingState, $billingPostcode, $emailToAdmin)
{
//if $emailToAdmin is true, then email docs to admin rather than to client.
$orderDate = date('Y-m-d H:i:s');
$billingArray = array(0 => $billingAddress1, 1 => $billingAddress2, 2 => $billingCity, 3 => $billingState, 4 => $billingPostcode);
$deedVersion = '2014-1';
$constitutionVersion = '2013-1';
//$itemData = print_r($item, true);
$product_name = $item['name'];
$product_id = $item['product_id'];
$trusteeType = $item['item_meta']['trusteeType'][0];
$nameArray = explode(' ', trim($billingName));
$firstName = $nameArray[0];
switch ($product_id) {
case '1005':
//NSF with individual trustees or pre-registered corporate trustee
if ($trusteeType == 'Individuals') {
$body = nsf_individual_post_Data($item, $order_id, $deedVersion, $constitutionVersion, $billingArray, $billingName, $billingCompany, $billing_phone, $orderItemId, $adviserEmail, $userID, $orderDate);
}
if ($trusteeType == 'Company - Already Registered') {
$body = nsf_corp_already_registered_post_Data($item, $order_id, $deedVersion, $constitutionVersion, $billingArray, $billingName, $billingCompany, $billing_phone, $orderItemId, $adviserEmail, $userID, $orderDate);
}
$urltopost = "http://172.31.5.172/submit-nsf.php";
$requestNSF = new WP_Http();
$response = $requestNSF->post($urltopost, array('body' => $body, 'blocking' => false));
break;
case '1149':
//NSF new corporate trustee registration
$body = nsf_and_corp_post_data($item, $order_id, $deedVersion, $constitutionVersion, $billingArray, $billingName, $billingCompany, $billing_phone, $orderItemId, $adviserEmail, $userID, $orderDate);
$urltopost = "http://172.31.5.172/submit-nsfcoy.php";
$requestNSFCO = new WP_Http();
$response = $requestNSFCO->post($urltopost, array('body' => $body, 'blocking' => false));
$to = 'tim@paratus.com.au';
$subject = 'NSFCO Data';
$message = 'Data: <br/>' . print_r($body, true);
wp_mail($to, $subject, $message);
break;
case '958':
//SDV
if ($trusteeType == 'Individuals') {
$body = sdv_indiv_post_Data($item, $order_id, $deedVersion, $constitutionVersion, $billingArray, $billingName, $billingCompany, $billing_phone, $orderItemId, $adviserEmail, $userID, $orderDate);
}
if ($trusteeType == 'Company - Already Registered') {
$body = sdv_corp_post_Data($item, $order_id, $deedVersion, $constitutionVersion, $billingArray, $billingName, $billingCompany, $billing_phone, $orderItemId, $adviserEmail, $userID, $orderDate);
}
$urltopost = "http://172.31.5.172/submit-sdv.php";
$requestSDV = new WP_Http();
$response = $requestSDV->post($urltopost, array('body' => $body, 'blocking' => false));
break;
case '1128':
//New company registration
$body = corp_post_Data($item, $order_id, $deedVersion, $constitutionVersion, $billingArray, $billingName, $billingCompany, $billing_phone, $orderItemId, $adviserEmail, $userID, $orderDate);
$urltopost = "http://172.31.5.172/submit-coy.php";
$requestCOY = new WP_Http();
$response = $requestCOY->post($urltopost, array('body' => $body, 'blocking' => false));
break;
case '1338':
//New pension
$body = pension_post_Data($item, $order_id, $deedVersion, $constitutionVersion, $billingArray, $billingName, $billingCompany, $billing_phone, $orderItemId, $adviserEmail, $userID, $orderDate);
$urltopost = "http://172.31.5.172/submit-pension.php";
$requestPSN = new WP_Http();
$response = $requestPSN->post($urltopost, array('body' => $body, 'blocking' => false));
break;
case '965':
//New Borrowing - Bank
$body = borrowing_post_Data($item, $order_id, $deedVersion, $constitutionVersion, $billingArray, $billingName, $billingCompany, $billing_phone, $orderItemId, $adviserEmail, $userID, $orderDate);
$urltopost = "http://172.31.5.172/submit-borrowing.php";
$requestBNK = new WP_Http();
$response = $requestBNK->post($urltopost, array('body' => $body, 'blocking' => false));
break;
case '1975':
//New Borrowing - Related Party
$body = borrowing_rp_post_Data($item, $order_id, $deedVersion, $constitutionVersion, $billingArray, $billingName, $billingCompany, $billing_phone, $orderItemId, $adviserEmail, $userID, $orderDate);
$urltopost = "http://172.31.5.172/submit-borrowingRP.php";
$requestRP = new WP_Http();
$response = $requestRP->post($urltopost, array('body' => $body, 'blocking' => false));
$to = 'tim@paratus.com.au';
$subject = 'RP Borrowing Data';
$message = 'Data: <br/>' . print_r($body, true);
wp_mail($to, $subject, $message);
break;
case '1330':
//New Change of Trustee
$body = cot_post_Data($item, $order_id, $deedVersion, $constitutionVersion, $billingArray, $billingName, $billingCompany, $billing_phone, $orderItemId, $adviserEmail, $userID, $orderDate);
$urltopost = "http://172.31.5.172/submit-cot.php";
$requestCOT = new WP_Http();
$response = $requestCOT->post($urltopost, array('body' => $body, 'blocking' => false));
// $to = 'tim@paratus.com.au';
// $subject = 'Deed Rule';
// $message = 'Data: <br/>'.print_r($body, true);
// wp_mail( $to, $subject, $message);
break;
case '2631':
//New Fixed Unit Trust
if ($trusteeType == 'Individuals') {
$body = fut_individual_post_Data($item, $order_id, $billingArray, $billingName, $billingCompany, $billing_phone, $product_id, $adviserEmail, $userID, $orderDate);
}
if ($trusteeType == 'Company - Already Registered') {
$body = fut_corp_already_registered_post_Data($item, $order_id, $billingArray, $billingName, $billingCompany, $billing_phone, $product_id, $adviserEmail, $userID, $orderDate);
}
//.........这里部分代码省略.........
示例6: verify_paypal_ipn
private static function verify_paypal_ipn()
{
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&{$key}={$value}";
}
$url = rgpost("test_ipn") ? self::$sandbox_url : self::$production_url;
self::log_debug("Sending IPN request to PayPal for validation. URL: {$url} - Data: {$req}");
$url_info = parse_url($url);
//Post back to PayPal system to validate
$request = new WP_Http();
$headers = array("Host" => $url_info["host"]);
$response = $request->post($url, array("httpversion" => "1.1", "headers" => $headers, "sslverify" => false, "ssl" => true, "body" => $req, "timeout" => 20));
self::log_debug("Response: " . print_r($response, true));
return !is_wp_error($response) && trim($response["body"]) == "VERIFIED";
}
示例7: testPostJsonAllowsPassingExtraParamsToWpHttpPost
public function testPostJsonAllowsPassingExtraParamsToWpHttpPost()
{
$this->wpHttp->post('uri', ['headers' => ['Accept' => 'application/json', 'Content-Type' => 'application/json'], 'body' => json_encode(['foo' => 'bar']), 'jim' => 'jam'])->shouldBeCalled();
$this->request->postJson('uri', ['foo' => 'bar'], ['jim' => 'jam']);
}
示例8: ml_pb_send_batch_notification
function ml_pb_send_batch_notification($data, $tagNames = array())
{
$data['msg'] = stripslashes($data['msg']);
$json_data = json_encode($data);
$headers = array('X-PUSHBOTS-APPID' => get_option('ml_pb_app_id'), 'X-PUSHBOTS-SECRET' => get_option('ml_pb_secret_key'), 'Content-Type' => 'application/json', 'Content-Length' => strlen($json_data));
$url = MOBILOUD_PB_URL . '/push/all';
$request = new WP_Http();
$result = $request->post($url, array('timeout' => 10, 'headers' => $headers, 'sslverify' => false, 'body' => $json_data));
global $wpdb;
$table_name = $wpdb->prefix . "mobiloud_notifications";
$wpdb->insert($table_name, array('time' => current_time("timestamp"), 'post_id' => isset($data['payload']['post_id']) ? $data['payload']['post_id'] : null, 'msg' => $data['msg'], 'android' => is_array($data['platform']) && in_array(1, $data['platform']) ? 'Y' : 'N', 'ios' => is_array($data['platform']) && in_array(0, $data['platform']) ? 'Y' : 'N', 'tags' => count($tagNames) > 0 ? implode(",", $tagNames) : ''));
}
示例9: post_to_sina_weibo
function post_to_sina_weibo($post_ID)
{
/* 此处修改为通过文章自定义栏目来判断是否同步 */
if (get_post_meta($post_ID, 'weibo_sync', true) == 1) {
return;
}
$get_post_info = get_post($post_ID);
$get_post_centent = get_post($post_ID)->post_content;
$get_post_title = get_post($post_ID)->post_title;
if ($get_post_info->post_status == 'publish' && $_POST['original_post_status'] != 'publish') {
$appkey = '' . git_get_option('git_wbapky_b') . '';
/* 此处是你的新浪微博appkey */
$username = '' . git_get_option('git_wbuser_b') . '';
$userpassword = '' . git_get_option('git_wbpasd_b') . '';
$request = new WP_Http();
$keywords = "";
/* 获取文章标签关键词 */
$tags = wp_get_post_tags($post_ID);
foreach ($tags as $tag) {
$keywords = $keywords . '#' . $tag->name . "#";
}
/* 修改了下风格,并添加文章关键词作为微博话题,提高与其他相关微博的关联率 */
$string1 = '【' . strip_tags($get_post_title) . '】:';
$string2 = $keywords . ' [阅读全文]:' . get_permalink($post_ID);
/* 微博字数控制,避免超标同步失败 */
$wb_num = (138 - WeiboLength($string1 . $string2)) * 2;
$status = $string1 . mb_strimwidth(strip_tags(apply_filters('the_content', $get_post_centent)), 0, $wb_num, '...') . $string2;
$api_url = 'https://api.weibo.com/2/statuses/update.json';
$body = array('status' => $status, 'source' => $appkey);
$headers = array('Authorization' => 'Basic ' . base64_encode("{$username}:{$userpassword}"));
$result = $request->post($api_url, array('body' => $body, 'headers' => $headers));
/* 若同步成功,则给新增自定义栏目weibo_sync,避免以后更新文章重复同步 */
add_post_meta($post_ID, 'weibo_sync', 1, true);
}
}
示例10: verify_paypalpro_ipn
private static function verify_paypalpro_ipn()
{
//read the post from PayPal Pro system and add 'cmd'
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&{$key}={$value}";
}
$url = RGForms::post("test_ipn") ? "https://www.sandbox.paypal.com/cgi-bin/websrc" : "https://www.paypal.com/cgi-bin/websrc";
$url_info = parse_url($url);
//Post back to PayPal system to validate
$request = new WP_Http();
$headers = array("Host" => $url_info["host"]);
$response = $request->post($url, array("httpversion" => "1.1", "headers" => $headers, "sslverify" => false, "ssl" => true, "body" => $req, "timeout" => 20));
self::log_debug("Response: " . print_r($response, true));
return !is_wp_error($response) && trim($response["body"]) == "VERIFIED";
}
示例11: nospamuser_check_bozo
function nospamuser_check_bozo($user_id)
{
// Most of this function is taken from Akismet
$settings = bb_get_option('nospamuser-settings');
if (empty($settings['api_key'])) {
return;
}
global $bb_current_user, $user_obj;
$bb_current_id = bb_get_current_user_info('id');
bb_set_current_user($user_id);
if ($bb_current_id && $bb_current_id != $user_id) {
if ($user_obj->data->is_bozo || !$bb_current_user->data->is_bozo) {
return;
}
}
bb_set_current_user((int) $bb_current_id);
$wp_http = new WP_Http();
$wp_http->post('http://www.stopforumspam.com/post.php', array('body' => array('username' => $user_obj->user_login, 'ip_addr' => $user_obj->data->nospamuser_ip, 'email' => $user_obj->user_email, 'api_key' => $settings['api_key']), 'user-agent' => apply_filters('http_headers_useragent', backpress_get_option('wp_http_version')) . NOSPAMUSER_AGENT));
}
示例12: post_to_lead_service
function post_to_lead_service($confirmation, $form, $entry)
{
$post_url = 'http://www.quickinsure.co.za/LeadService/Service.asmx/SubmitLatestLoanLead';
$body = array('UserId' => rgar($entry, '16'), 'Firstname' => rgar($entry, '1'), 'Surname' => rgar($entry, '2'), 'Email' => rgar($entry, '3'), 'CellNo' => rgar($entry, '4'), 'WorkNo' => rgar($entry, '5'), 'IdNo' => rgar($entry, '17'), 'NetSalary' => rgar($entry, '18'), 'GrossSalary' => rgar($entry, '19'), 'LoanAmount' => rgar($entry, '20'), 'EmploymentTime' => rgar($entry, '11'), 'UnderDebtReview' => rgar($entry, '21'), 'Bank' => rgar($entry, '13'), 'SubId' => rgar($entry, '14'), 'TestMode' => rgar($entry, '15'));
GFCommon::log_debug('gform_confirmation: body => ' . print_r($body, true));
$request = new WP_Http();
$response = $request->post($post_url, array('body' => $body));
GFCommon::log_debug('gform_confirmation_1: response => ' . print_r($response, true));
return $confirmation;
}
示例13: request_next_step_execution
private function request_next_step_execution()
{
if (!($task = $this->get_pending_task()) || $this->get_executing_task()) {
return false;
} elseif ($this->was_executed($task)) {
/**
* Early prevent duplicate execution
* Same check is done in @see execute_pending_task()
* but this will prevent a redundant request
*/
return false;
}
$http = new WP_Http();
$http->post(site_url('wp-admin/admin-ajax.php'), array('blocking' => false, 'timeout' => 0.01, 'sslverify' => false, 'body' => array('action' => self::$wp_ajax_action, 'token' => md5(defined('NONCE_SALT') ? NONCE_SALT : self::backups()->manifest->get_version()), 'active_tasks_hash' => ($collection = $this->get_active_task_collection()) ? md5(serialize($collection)) : '')));
return true;
}
示例14: jw_baiping
function jw_baiping($post_id)
{
$baiduXML = 'weblogUpdates.extendedPing' . get_option('blogname') . ' ' . home_url() . ' ' . get_permalink($post_id) . ' ' . get_feed_link() . ' ';
$wp_http_obj = new WP_Http();
$return = $wp_http_obj->post('http://ping.baidu.com/ping/RPC2', array('body' => $baiduXML, 'headers' => array('Content-Type' => 'text/xml')));
if (isset($return['body'])) {
if (strstr($return['body'], '0')) {
$noff_log = 'succeeded!';
} else {
$noff_log = 'failed!';
}
} else {
$noff_log = 'failed!';
}
}
示例15: array
function wp_http_post($url, $data)
{
$http = new WP_Http();
$response = $http->post($url, array('body' => $data));
return $response['body'];
}