当前位置: 首页>>代码示例>>PHP>>正文


PHP Curl::simple_post方法代码示例

本文整理汇总了PHP中Curl::simple_post方法的典型用法代码示例。如果您正苦于以下问题:PHP Curl::simple_post方法的具体用法?PHP Curl::simple_post怎么用?PHP Curl::simple_post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Curl的用法示例。


在下文中一共展示了Curl::simple_post方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: webservice_post

function webservice_post($url, $params, $jsonRequest = FALSE)
{
    // Parse the RequestMethod out of the request for debugging purposes
    if (isset($params['RequestMethod'])) {
        $requestMethod = $params['RequestMethod'];
    } else {
        $requestMethod = '';
    }
    if (empty($url)) {
        log_message('error', "Canceling {$requestMethod} POST to an empty URL");
        return array('Message' => 'Web service URL is not configured');
    }
    if ($jsonRequest) {
        $params = json_encode($params);
    }
    // POST our query and fetch the response
    $curl = new Curl();
    $response = $curl->simple_post($url, $params);
    //log_message('debug', sprintf('Response received from %s POST to %s: %s', $requestMethod, $url, $response));
    // JSON decode the response
    $response = json_decode($response, TRUE);
    if (!isset($response)) {
        $response = array('Message' => 'Invalid or missing response');
    }
    return $response;
}
开发者ID:ronfesta,项目名称:simiangrid,代码行数:26,代码来源:index.php

示例2: postUpdateCard

 public function postUpdateCard()
 {
     // Add Curl library
     require_once app_path() . "/libraries/Curl/Curl.php";
     // Get Product
     $product = Product::where('code', Input::get('code'))->first();
     // Get Expiry month and year
     $expiry = explode(' / ', Input::get('ccExpire'));
     // Put all values in session
     Session::flash('ccNum', Input::get('ccNum'));
     Session::flash('ccExpire', Input::get('ccExpire'));
     Session::flash('ccCVC', Input::get('ccCVC'));
     $data = array('email' => Input::get('email'), 'code' => Input::get('code'), 'number' => Input::get('ccNum'), 'exp_month' => !empty($expiry[0]) ? $expiry[0] : NULL, 'exp_year' => !empty($expiry[1]) ? $expiry[1] : NULL, 'cvc' => Input::get('ccCVC'));
     $data['key'] = DKHelpers::GenerateHash($data, $product->api_key);
     $url = url() . "/api/v1/update-card";
     // Post data to IPN
     $curl = new Curl();
     $response = $curl->simple_post($url, $data, array(CURLOPT_BUFFERSIZE => 10));
     $response = json_decode($response);
     if (empty($response->error)) {
         $success = "Your card (**** **** **** {$response->last4}) has been updated successfully.";
         return Redirect::back()->with('success', $success);
     } else {
         return Redirect::back()->with('error', $response->error);
     }
 }
开发者ID:michaelotto126,项目名称:dksolution,代码行数:26,代码来源:CustomersController.php

示例3: statistics

 /**
  * Sends statistics back to pyrocms.com
  *
  * These are only used to see which OS's we should develop for and are anonymous.
  *
  * @author jeroenvdgulik
  * @since 1.0.1
  */
 public function statistics()
 {
     $this->load->library('installer_lib');
     $this->installer_lib->mysql_acceptable('server');
     $this->installer_lib->mysql_acceptable('client');
     $this->installer_lib->gd_acceptable();
     $data = array('version' => CMS_VERSION, 'php_version' => phpversion(), 'webserver_hash' => md5($this->session->userdata('http_server') . $this->input->server('SERVER_NAME') . $this->input->server('SERVER_ADDR') . $this->input->server('SERVER_SIGNATURE')), 'webserver_software' => $this->input->server('SERVER_SOFTWARE'), 'dbserver' => $this->installer_lib->mysql_server_version, 'dbclient' => $this->installer_lib->mysql_client_version, 'gd_version' => $this->installer_lib->gd_version, 'zlib_version' => $this->installer_lib->zlib_enabled(), 'curl' => $this->installer_lib->curl_enabled());
     include '../system/sparks/curl/1.2.1/libraries/Curl.php';
     $url = 'https://www.pyrocms.com/statistics/add';
     $curl = new Curl();
     $curl->simple_post($url, $data);
 }
开发者ID:nvmanh,项目名称:codeigniter-shop,代码行数:20,代码来源:ajax.php

示例4: update_appearance

function update_appearance($userID, $appearance)
{
    $config =& get_config();
    $url = $config['user_service'];
    $params = array('RequestMethod' => 'AddUserData', 'UserID' => $userID, 'LLPackedAppearance' => json_encode($appearance));
    $curl = new Curl();
    $response = json_decode($curl->simple_post($url, $params), TRUE);
    if (!isset($response)) {
        log_message('error', "Update appearance call to {$url} failed");
        $response = array('Message' => 'Invalid or missing response');
    }
    return $response;
}
开发者ID:QuillLittlefeather,项目名称:mgm-simiangrid,代码行数:13,代码来源:Class.AddInventory.php

示例5: getPayload

 public function getPayload()
 {
     $code = Input::get('code');
     $api_key = Input::get('api_key');
     $license_key = Input::get('license');
     $activate = Input::get('activate');
     $current_url = url("admin/licenses/payload?code={$code}&api_key={$api_key}&license={$license_key}");
     // Page Title
     $this->_data['page_title'] = "Licenses - Get Payload";
     $this->_data['license_key'] = $license_key;
     $this->_data['uses'] = LicensesUses::getAllUsage($license_key);
     // Include libraries
     require_once app_path() . "/libraries/Curl/Curl.php";
     $params = array("code" => $code, "license" => $license_key);
     $curl = new Curl();
     if ($activate) {
         $params['guid'] = time();
     }
     $params['key'] = DKHelpers::GenerateHash($params, $api_key);
     if ($activate) {
         $response = $curl->simple_post(url('api/v1/license-manager/activate'), $params, array(CURLOPT_BUFFERSIZE => 10));
         $response = json_decode($response);
         if (isset($response->success) and $response->success == 'false') {
             if (isset($response->overusage) and $response->overusage == 'true') {
                 Session::flash('alert_error', '<strong>Alert!</strong> License cannot be activated due to overusage.');
                 return Redirect::to($current_url);
             }
         } else {
             Session::flash('alert_message', '<strong>Done!</strong> License has been activated successfully.');
             return Redirect::to($current_url);
         }
     }
     // Get Payload
     $this->_data['payload'] = $curl->simple_post(url('api/v1/license-manager'), $params, array(CURLOPT_BUFFERSIZE => 10));
     $this->_data['activate_url'] = $current_url . '&activate=true';
     return View::make('admin.licenses.payload', $this->_data)->nest('header', 'admin.common.header', $this->_data)->nest('footer', 'admin.common.footer', $this->_data);
 }
开发者ID:michaelotto126,项目名称:dksolution,代码行数:37,代码来源:LicensesController.php

示例6: webservice_post

/**
 * @author Philip Sturgeon
 * @created 9 Dec 2008
 */
function webservice_post($url, $params, $jsonRequest = FALSE)
{
    if (empty($url)) {
        log_message('error', 'Canceling web service POST to an empty URL');
        return array('Message' => 'Web service address is not configured');
    }
    if ($jsonRequest) {
        $params = json_encode($params);
    }
    $curl = new Curl();
    $response = $curl->simple_post($url, $params);
    $jsonResponse = json_decode($response, TRUE);
    if (empty($jsonResponse)) {
        log_message('error', "Invalid or missing response from {$url}");
        $jsonResponse = array('Message' => 'Invalid or missing response: ' . $response);
    }
    return $jsonResponse;
}
开发者ID:QuillLittlefeather,项目名称:mgm-simiangrid,代码行数:22,代码来源:Class.Curl.php

示例7: curlData

 /**
  * Curl data
  *
  * @return void
  * @author apple
  **/
 function curlData($url, $params = array(), $type = 'GET', $debug = 0, $options = array())
 {
     $cl = new Curl();
     if ($type == 'GET') {
         $params = $params ? '?' . MY_paraseGetArray($params) : "";
         $curl['url'] = site_url($url . $params);
         $json = $cl->simple_get($curl['url'], $options);
     } else {
         $curl['url'] = site_url($url);
         $json = $cl->simple_post($curl['url'], $params, $options);
     }
     if ($debug) {
         $cl->debug();
     }
     // debug
     $json = json_decode($json, TRUE);
     return $json;
 }
开发者ID:Demired,项目名称:CakeWX,代码行数:24,代码来源:func.php

示例8: completeRefund

 /**
  * Complete refund and push notification
  */
 static function completeRefund($transaction)
 {
     // Update transaction
     $transaction->is_refunded = 1;
     $transaction->save();
     // Push to IPN
     $ipn_data = array("type" => "refund", "plan" => $transaction->plan->code, "email" => $transaction->purchase->buyer->email);
     // Add Curl library
     require_once app_path() . "/libraries/Curl/Curl.php";
     // Add an encrypted key to the request
     $ipn_data['key'] = DKHelpers::GenerateHash($ipn_data, $transaction->purchase->product->api_key);
     // Post data to IPN
     $curl = new Curl();
     $curl->simple_post($transaction->purchase->product->ipn_url, $ipn_data, array(CURLOPT_BUFFERSIZE => 10));
     // Send refund email to buyer
     self::send_email_refund($transaction->purchase->product->name, $transaction->plan->name, $transaction->purchase->buyer->email, $transaction->pay_id, $transaction->amount);
     return TRUE;
 }
开发者ID:michaelotto126,项目名称:dksolution,代码行数:21,代码来源:Transaction.php

示例9: statistics

	/**
	 * Sends statistics back to pyrocms.com. These are only used to see which OS's we should develop for
	 * and are anonymous.
	 *
	 * @access	public
	 * @author	jeroenvdgulik
	 * @since	1.0.0.0
	 * @return	void
	 */
	public function statistics()
	{
		$this->load->library('installer_lib');
		$this->installer_lib->mysql_acceptable('server');
		$this->installer_lib->mysql_acceptable('client');
		$this->installer_lib->gd_acceptable();
		
		$data = array(	'version'			=>	CMS_VERSION,
						'ip_address'		=>	$this->input->ip_address(),
						'ip_address_long'	=>	ip2long($this->input->ip_address()),
						'php_version'		=>	phpversion(),
						'webserver'			=>	$this->session->userdata('http_server'),
						'webserver_name'	=>	$this->input->server('SERVER_NAME'),
						'webserver_host'	=>	$this->input->server('HTTP_HOST'),
						'webserver_address'	=>	$this->input->server('SERVER_ADDR'),
						'webserver_signature'	=> $this->input->server('SERVER_SIGNATURE'),
						'webserver_software'	=> $this->input->server('SERVER_SOFTWARE'),
						'dbserver'			=>	$this->installer_lib->mysql_server_version,
						'dbclient'			=>	$this->installer_lib->mysql_client_version,
						'gd_version'		=>	$this->installer_lib->gd_version,
						'zlib_version'		=>	$this->installer_lib->zlib_enabled(),
						'curl'				=>	$this->installer_lib->curl_enabled(),
					);
		
		include '../system/pyrocms/libraries/Curl.php';
		$url = 'http://pyrocms.com/statistics/add ';
		$curl = new Curl();
		$curl->simple_post($url, $data);
	}
开发者ID:prolabs,项目名称:pyrocms,代码行数:38,代码来源:ajax.php

示例10: webservice_post

function webservice_post($url, $params, $jsonRequest = FALSE)
{
    // Parse the RequestMethod out of the request for debugging purposes
    if (isset($params['RequestMethod'])) {
        $requestMethod = $params['RequestMethod'];
    } else {
        $requestMethod = '';
    }
    if (empty($url)) {
        log_message('error', "Canceling {$requestMethod} POST to an empty URL");
        return array('Message' => 'Web service URL is not configured');
    }
    $options = array();
    if ($jsonRequest) {
        $params = json_encode($params);
        $options[CURLOPT_HTTPHEADER] = array('Content-Type: application/json');
    }
    // POST our query and fetch the response
    $curl = new Curl();
    $response = $curl->simple_post($url, $params, $options);
    // JSON decode the response
    $response = decode_recursive_json($response);
    if (!isset($response)) {
        $response = array('Message' => 'Invalid or missing response');
    }
    return $response;
}
开发者ID:QuillLittlefeather,项目名称:mgm-simiangrid,代码行数:27,代码来源:SimianGrid.php

示例11: link_remote_handler

function link_remote_handler($data)
{
    $x = $_POST['x'];
    $y = $_POST['y'];
    $hguri = $_POST['hg_uri'];
    $region_name = $_POST['region_name'];
    $link_request = xmlrpc_encode_request('link_region', array('region_name' => $region_name));
    $curl = new Curl();
    $response_raw = $curl->simple_post($hguri, $link_request);
    $response = xmlrpc_decode($response_raw);
    $success = $response['result'];
    if ($success) {
        $uuid = $response['uuid'];
        $external_name = $response['external_name'];
        $region_image = $response['region_image'];
        if (hg_link_region($uuid, $region_name, $external_name, $x, $y, $region_image, $hguri)) {
            $success = true;
        }
    } else {
        log_message('debug', "result was false didn't link!");
    }
    echo '{"success": ' . $success . '}';
    exit;
}
开发者ID:QuillLittlefeather,项目名称:mgm-simiangrid,代码行数:24,代码来源:hypergrid.php

示例12: getPaypalConfirmOto


//.........这里部分代码省略.........
      *  Unique PayPal buyer account identification number as returned in the GetExpressCheckoutDetails response
      */
     $payerId = urlencode($_REQUEST['PayerID']);
     $paymentAction = "Sale";
     //urlencode(  $_REQUEST['paymentAction']);
     // ------------------------------------------------------------------
     // this section is optional if parameters required for DoExpressCheckout is retrieved from your database
     $getExpressCheckoutDetailsRequest = new PayPal\PayPalAPI\GetExpressCheckoutDetailsRequestType($token);
     $getExpressCheckoutReq = new PayPal\PayPalAPI\GetExpressCheckoutDetailsReq();
     $getExpressCheckoutReq->GetExpressCheckoutDetailsRequest = $getExpressCheckoutDetailsRequest;
     // ------------------------------------------------------------------
     // this section get checkout data from PayPal
     $getExpressCheckoutDetailsRequest = new PayPal\PayPalAPI\GetExpressCheckoutDetailsRequestType($token);
     $getExpressCheckoutReq = new PayPal\PayPalAPI\GetExpressCheckoutDetailsReq();
     $getExpressCheckoutReq->GetExpressCheckoutDetailsRequest = $getExpressCheckoutDetailsRequest;
     /*
     Configuration::getAcctAndConfig() returns array that contains credential and config parameters
     */
     $paypalService = new PayPal\Service\PayPalAPIInterfaceServiceService($config);
     try {
         /* wrap API method calls on the service object with a try catch */
         $getECResponse = $paypalService->GetExpressCheckoutDetails($getExpressCheckoutReq);
     } catch (Exception $ex) {
         echo "Error occured while charging for PayPal";
         exit;
     }
     //----------------------------------------------------------------------------
     try {
         /* wrap API method calls on the service object with a try catch */
         $getECResponse = $paypalService->GetExpressCheckoutDetails($getExpressCheckoutReq);
     } catch (Exception $ex) {
         echo "Error occured while charging for PayPal";
         exit;
     }
     if (isset($getECResponse)) {
         $amount = $getECResponse->GetExpressCheckoutDetailsResponseDetails->PaymentDetails[0]->OrderTotal->value;
     }
     /*
      * The total cost of the transaction to the buyer. If shipping cost (not applicable to digital goods) and tax charges are known, include them in this value. If not, this value should be the current sub-total of the order. If the transaction includes one or more one-time purchases, this field must be equal to the sum of the purchases. Set this field to 0 if the transaction does not include a one-time purchase such as when you set up a billing agreement for a recurring payment that is not immediately charged. When the field is set to 0, purchase-specific fields are ignored.
      */
     $orderTotal = new PayPal\CoreComponentTypes\BasicAmountType();
     $orderTotal->currencyID = 'USD';
     $orderTotal->value = $amount;
     //$_REQUEST['amt'];
     $paymentDetails = new PayPal\EBLBaseComponents\PaymentDetailsType();
     $paymentDetails->OrderTotal = $orderTotal;
     /*
      * Your URL for receiving Instant Payment Notification (IPN) about this transaction. If you do not specify this value in the request, the notification URL from your Merchant Profile is used, if one exists.
      */
     $paymentDetails->NotifyURL = Config::get('project.paypal_ipn_url');
     $DoECRequestDetails = new PayPal\EBLBaseComponents\DoExpressCheckoutPaymentRequestDetailsType();
     $DoECRequestDetails->PayerID = $payerId;
     $DoECRequestDetails->Token = $token;
     $DoECRequestDetails->PaymentAction = $paymentAction;
     $DoECRequestDetails->PaymentDetails[0] = $paymentDetails;
     $DoECRequest = new PayPal\PayPalAPI\DoExpressCheckoutPaymentRequestType();
     $DoECRequest->DoExpressCheckoutPaymentRequestDetails = $DoECRequestDetails;
     $DoECReq = new PayPal\PayPalAPI\DoExpressCheckoutPaymentReq();
     $DoECReq->DoExpressCheckoutPaymentRequest = $DoECRequest;
     try {
         /* wrap API method calls on the service object with a try catch */
         $DoECResponse = $paypalService->DoExpressCheckoutPayment($DoECReq);
     } catch (Exception $ex) {
         echo "Error occured while charging for PayPal";
         exit;
     }
     if (isset($DoECResponse)) {
         // Get Transaction ID
         if (!empty($DoECResponse->DoExpressCheckoutPaymentResponseDetails->PaymentInfo[0]->TransactionID)) {
             $transaction_id = $DoECResponse->DoExpressCheckoutPaymentResponseDetails->PaymentInfo[0]->TransactionID;
         } else {
             Log::info('PayPal EC Confirm failed', array('buyer' => $buyer, 'product' => $product->id, 'plan' => $plan->id, 'COData' => $DoECResponse));
             // Redirect back them to PayPal with token
             return Redirect::to(Config::get('project.paypal_api_url') . 'cgi-bin/webscr?cmd=_express-checkout&token=' . trim($_REQUEST['token']));
         }
         // Update Buyer IP
         Buyer::updateLastIP($buyer);
         // Get Purchase ID
         $purchase = Purchase::where('product_id', '=', $product->id)->where('buyer_id', '=', $buyer->id)->first();
         // If we successfully get the recurring ID
         if (!empty($paypal_sub_id)) {
             $purchase->paypal_sub_id = $paypal_sub_id;
             $purchase->save();
         }
         // Push data using own IPN
         $ipn_url = Config::get('project.paypal_ipn_url');
         $data_curl = array("dk_new_charge" => TRUE, "transaction_id" => $transaction_id, "buyer_id" => $buyer->id, "plan_id" => $plan->id, "product_id" => $product->id, "amount" => $amount);
         $curl = new Curl();
         $curl->simple_post($ipn_url, $data_curl, array(CURLOPT_BUFFERSIZE => 10));
         // Everything is ok, now remove session data
         // for security purpose
         Session::forget('_product');
         Session::forget('_plan');
         Session::forget('_buyer');
         // Redirect
         $url = url('checkout/thanks?url=' . $plan->next_page_url . '&code=' . $product->code);
         return Redirect::to($url);
         //return Redirect::to($plan->next_page_url);
     }
 }
开发者ID:michaelotto126,项目名称:dksolution,代码行数:101,代码来源:CheckoutController.php

示例13: _push_ipn

 /**
  * Push IPN to product IPN URL
  * 
  * Types: Sales, Refund, Cancel
  */
 private function _push_ipn($url, $data)
 {
     Log::info('DK IPN Log', $data);
     // Add Curl library
     require_once app_path() . "/libraries/Curl/Curl.php";
     // Post data to IPN
     $curl = new Curl();
     $curl->simple_post($url, $data, array(CURLOPT_BUFFERSIZE => 10, CURLOPT_SSL_VERIFYPEER => false));
     // Store IPN ping in DB with status
 }
开发者ID:michaelotto126,项目名称:dksolution,代码行数:15,代码来源:IpnController.php


注:本文中的Curl::simple_post方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。