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)); }
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)); }
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)); }
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'; }
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 = '*****@*****.**'; $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 = '*****@*****.**'; $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 = '*****@*****.**'; // $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); } if ($trusteeType == 'Company') { $body = fut_corp_already_registered_post_Data($item, $order_id, $billingArray, $billingName, $billingCompany, $billing_phone, $product_id, $adviserEmail, $userID, $orderDate); } $urltopost = "http://172.31.5.172/submit-fut.php"; $requestNSF = new WP_Http(); $response = $requestNSF->post($urltopost, array('body' => $body, 'blocking' => false)); $to = '*****@*****.**'; $subject = 'Deed Rule'; $message = 'Data: <br/>' . print_r($body, true); wp_mail($to, $subject, $message); break; //2631 } }
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"; }
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']); }
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) : '')); }
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); } }
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"; }
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)); }
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; }
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; }
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!'; } }
function wp_http_post($url, $data) { $http = new WP_Http(); $response = $http->post($url, array('body' => $data)); return $response['body']; }
private static function verify_paypal_ipn() { //read the post from PayPal 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") ? self::$sandbox_url : self::$production_url; self::log_debug("Sending IPN request to PayPal for validation. URL: {$url} - Data: {$req}"); //Post back to PayPal system to validate $request = new WP_Http(); $response = $request->post($url, array("sslverify" => false, "ssl" => true, "body" => $req, "timeout" => 20)); self::log_debug("Response: " . print_r($response, true)); return !is_wp_error($response) && $response["body"] == "VERIFIED"; }
function create_xero_invoice($order_id) { //create Xero Invoice $to = '*****@*****.**'; $subject = 'Started Xero Invoice Method'; $message = ''; wp_mail($to, $subject, $message); $data = array(); $order = new WC_Order($order_id); $items = $order->get_items(); $OrderItemIds = array_keys($items); $numberOfItems = $order->get_item_count(); $data['firstName'] = $order->billing_first_name; $data['lastName'] = $order->billing_last_name; $data['emailAddress'] = $order->billing_email; $data['date'] = "01/01/2014"; $data['status'] = "DRAFT"; if (!is_null($order->billing_company)) { $data['name'] = $order->billing_company; } else { $data['name'] = $order->billing_first_name . ' ' . $order->billing_last_name; } if (!is_null($order->billing_address_1)) { $data['streetLevel'] = $order->billing_address_1; $data['postLevel'] = $order->billing_address_1; } else { $data['streetLevel'] = ''; $data['postLevel'] = ''; } if (!is_null($order->billing_address_2)) { $data['streetStreet'] = $order->billing_address_2; $data['postStreet'] = $order->billing_address_2; } else { $data['streetStreet'] = ''; $data['postStreet'] = ''; } if (!is_null($order->billing_city)) { $data['streetSuburb'] = $order->billing_city; $data['postSuburb'] = $order->billing_city; } else { $data['streetSuburb'] = ''; $data['postSuburb'] = ''; } if (!is_null($order->billing_state)) { $data['streetState'] = $order->billing_state; $data['postState'] = $order->billing_state; } else { $data['streetState'] = ''; $data['postState'] = ''; } if (!is_null($order->billing_postcode)) { $data['streetPostcode'] = $order->billing_postcode; $data['postPostcode'] = $order->billing_postcode; } else { $data['streetPostcode'] = ''; $data['postPostcode'] = ''; } $data['contact'] = array("Name" => $data['name'], "FirstName" => $data['firstName'], "LastName" => $data['lastName'], "EmailAddress" => $data['emailAddress'], "Addresses" => array("Address" => array("AddressType" => "STREET", "AddressLine1" => $data['streetLevel'], "AddressLine2" => $data['streetStreet'], "City" => $data['streetSuburb'], "Region" => $data['streetState'], "PostalCode" => $data['streetPostcode']), "Address" => array("AddressType" => "POBOX", "AddressLine1" => $data['postLevel'], "AddressLine2" => $data['postStreet'], "City" => $data['postSuburb'], "Region" => $data['postState'], "PostalCode" => $data['postPostcode']))); $counter = 0; $data['submitfile'] = "submit-nsf.php"; $data['orderServiceType'] = $item['item_meta']['Service Type'][0]; $data['Reference'] = $order_id; foreach ($items as $item) { $orderItemId = $OrderItemIds[$counter]; $product_id = $item['product_id']; $product = $order->get_product_from_item($item); $product_sku = $product->get_sku(); $lastTwoLetters = substr($product_sku, -2); if ($lastTwoLetters == "ED") { $data['orderServiceType'] = "Electronic Delivery"; } elseif ($lastTwoLetters == "PD") { $data['orderServiceType'] = "Paper Delivery"; } else { $data['orderServiceType'] = "Premium Service"; } switch ($product_id) { case "1005": //NSF $description = "Documentation for the establishment of " . $item['item_meta']['fundName'][0]; $itemCode = 'NSF-' . $lastTwoLetters; $taxType = "OUTPUT"; $itemPrice = $item['line_subtotal']; $hasCompany = 0; break; case "1149": //NSFCOY $description = "Documentation for the establishment of " . $item['item_meta']['fundName'][0] . " and incorporation of " . $item['item_meta']['companyName'][0] . " " . $item['item_meta']['companySuffix'][0]; $itemCode = 'NSFCOY-' . $lastTwoLetters; $taxType = "OUTPUT"; $itemPrice = $item['line_subtotal'] - 444; $hasCompany = 1; break; case "1128": //COY $description = "Documentation for the incorporation of " . $item['item_meta']['companyName'][0] . " " . $item['item_meta']['companySuffix'][0]; $itemCode = 'COY-' . $lastTwoLetters; $taxType = "OUTPUT"; $itemPrice = $item['line_subtotal'] - 444; $hasCompany = 1; break; case "958": //SDV $description = "Documentation to update the trust deed for " . $item['item_meta']['fundName'][0]; $itemCode = 'SDV-' . $lastTwoLetters; $taxType = "OUTPUT"; $itemPrice = $item['line_subtotal']; $hasCompany = 0; break; case "965": //Borrowing $description = "Documentation to implement a limited recourse borrowing arrangement for " . $item['item_meta']['fundName'][0]; $itemCode = 'LRBA-' . $lastTwoLetters; $taxType = "OUTPUT"; $itemPrice = $item['line_subtotal']; $hasCompany = 0; break; case "1338": //Pension $description = "Documentation for the the commencement of a SMSF pension for " . $item['item_meta']['fundName'][0]; $itemCode = 'PSN-' . $lastTwoLetters; $taxType = "OUTPUT"; $itemPrice = $item['line_subtotal']; $hasCompany = 0; break; case "1330": //COT $description = "Documentation for the the commencement of a SMSF pension for " . $item['item_meta']['fundName'][0]; $itemCode = 'COT-' . $lastTwoLetters; $taxType = "OUTPUT"; $itemPrice = $item['line_subtotal']; $hasCompany = 0; break; } $lineItem = array("Quantity" => "1.0000", "ItemCode" => $itemCode, "Description" => $description, "UnitAmount" => $itemPrice, "TaxType" => $taxType); $data['lineAmountTypes'] = "Inclusive"; $data['lineItems'] = array("LineItem" => array()); $data['date'] = ''; $data['lineItems']['LineItem'][] = $lineItem; if ($hasCompany == 1) { $lineItem = array("Quantity" => "1.0000", "ItemCode" => "ASIC", "Description" => "ASIC Fee for Incorporation of " . $item['item_meta']['companyName'][0] . " " . $item['item_meta']['companySuffix'][0], "UnitAmount" => "444.0000", "TaxType" => "EXEMPTOUTPUT"); $data['lineItems']['LineItem'][] = $lineItem; } } $request = new WP_Http(); $response = $request->post('http://www.paratus.com.au/wp-content/themes/goodchoice/includes/post-xero.php', array('body' => $data, 'blocking' => false)); }