C/C++ VISA通信错误,错误码为-1073807339

一个上位机程序,GPIB通信协议,与34970A通信,C/C++编写,使用VISA函数,无非就是下指令,读取返回值,代码里常用的函数包括viOpen、viQueryf、viWrite、viRead等简单的函数,可以正常通信。问题是viQueryf有时候会出错,错误代码为-1073807339,查了一下,错误信息是:VI_ERROR_TMO。
查了很多资料,有大神说是下的指令太多,timeout了,我就在viOpen函数里添加了超时10s(不知道是不是这里,汗...),完全没有作用。
请教各位大神,是否有好的解决办法,或者猜想等等...

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
C/C++ VISA通信错误,错误码为-1073807339

一个上位机程序,GPIB通信协议,与34970A通信,C/C++编写,使用VISA函数,无非就是下指令,读取返回值,代码里常用的函数包括viOpen、viQueryf、viWrite、viRead等简单的函数,可以正常通信。问题是viQueryf有时候会出错,错误代码为-1073807339,查了一下,错误信息是:VI_ERROR_TMO。 查了很多资料,有大神说是下的指令太多,timeout了,我就在viOpen函数里添加了超时10s(不知道是不是这里,汗...),完全没有作用。 请教各位大神,是否有好的解决办法,或者猜想等等...

QT使用VISA库编译出错问题?

在用QT使用VISA库的时候编译出现 error: undefined reference to `viOpenDefaultRM' 的一系列错误 ![图片说明](https://img-ask.csdn.net/upload/201909/02/1567413535_292336.png) /------------------------------------------------------------------/ ![图片说明](https://img-ask.csdn.net/upload/201909/02/1567413546_151062.png) 电脑上已经成功下载了visa库 pro文件也加上了 INCLUDEPATH += "C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Include" LIBS += "C:\Program Files (x86)\IVI Foundation\VISA\WinNT\lib\msc\visa32.lib" 头文件 #include <visa.h>也加上了 求大佬帮我解问题

传感器labview通信错误为-1073807360 (arg 1)是怎么回事?

想让手上的传感器和labview进行通信传输数据,传感器采用的是RS232(USB虚拟com端口) ![图片说明](https://img-ask.csdn.net/upload/201811/26/1543223252_287287.png) 这是我的程序: ![图片说明](https://img-ask.csdn.net/upload/201811/26/1543223569_173686.png) 配置(和传感器一致没有问题): 19200baud 8 data Bits no parity bit 1 stop bit no handshaking 电脑:win7家庭普通版,64位;labview2017 运行后显示:VISA Configure Serial Port (Instr).vi->传感器.vi中的属性节点 (arg 1) ![图片说明](https://img-ask.csdn.net/upload/201811/26/1543223736_265374.png) 查找ni.com曾尝试过以下方法均未解决: 1、端口被占用需要重启,重启后未解决; 2、Windows有关USB的能源设置问题,重新设置后未解决; 3、禁用端口后重启未解决; 请教各位大神,万分感谢!

labview的VISA无法读取数据

做了一个简单的VISA从单片机读取数据,不知哪里出错了,总是读取不到?从VISA配置就开始提示ERR(-1073807194) 单片机的程序应该是没问题的,因为用串口助手能读到数据。 ![读取数据程序框图](https://img-ask.csdn.net/upload/201704/20/1492692283_945160.png) ![提示错误](https://img-ask.csdn.net/upload/201704/20/1492692595_976270.png)

重定向页面仅显示订单摘要(authorize.net接受的主机)

<div class="post-text" itemprop="text"> <p>I am using the php sdk provided by authorize.net. The particular method is the accepted host method using a redirected page. 1) The token is returned with I00001 Successful message 2) The page does not display anything but order summary at the top. 3) I also get the error below in the Chrome console.</p> <p>I have been fighting this for over 2 weeks to no avail, any help you all can give me would be greatly appreciated. Jim</p> <p>ERROR MESSAGE IN CHROME CONSOLE:</p> <p>payment:24 Uncaught SyntaxError: Invalid or unexpected token</p> <p>CODE USED:</p> <pre><code>function sdk_test() { //----------------------------------------------------------- //Create a merchantAuthenticationType object with authentication details //retrieved from the constants file //----------------------------------------------------------- $merchantAuthentication = new AnetAPI\MerchantAuthenticationType(); //$merchantAuthentication-&gt;setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); $merchantAuthentication-&gt;setName($this-&gt;anobj-&gt;get_field('login')); //$merchantAuthentication-&gt;setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); $merchantAuthentication-&gt;setTransactionKey($this-&gt;anobj-&gt;get_field('x_trans_key')); //----------------------------------------------------------- // Set the transaction's refId //----------------------------------------------------------- $refId = 'ref' . time(); //----------------------------------------------------------- // Create the payment data for a credit card //----------------------------------------------------------- $creditCard = new AnetAPI\CreditCardType(); $creditCard-&gt;setCardNumber("4111111111111111"); $creditCard-&gt;setExpirationDate("2038-12"); $creditCard-&gt;setCardCode("123"); //----------------------------------------------------------- // Add the payment data to a paymentType object //----------------------------------------------------------- $paymentOne = new AnetAPI\PaymentType(); $paymentOne-&gt;setCreditCard($creditCard); //----------------------------------------------------------- // Create order information //----------------------------------------------------------- $order = new AnetAPI\OrderType(); $order-&gt;setInvoiceNumber("10101"); $order-&gt;setDescription("Golf Shirts"); //----------------------------------------------------------- // Set the customer's Bill To address //----------------------------------------------------------- $customerAddress = new AnetAPI\CustomerAddressType(); $customerAddress-&gt;setFirstName("Ellen"); $customerAddress-&gt;setLastName("Johnson"); $customerAddress-&gt;setCompany("Souveniropolis"); $customerAddress-&gt;setAddress("14 Main Street"); $customerAddress-&gt;setCity("Pecan Springs"); $customerAddress-&gt;setState("TX"); $customerAddress-&gt;setZip("44628"); $customerAddress-&gt;setCountry("USA"); //----------------------------------------------------------- // Set the customer's identifying information //----------------------------------------------------------- $customerData = new AnetAPI\CustomerDataType(); $customerData-&gt;setType("individual"); $customerData-&gt;setId("99999456654"); $customerData-&gt;setEmail("EllenJohnson@example.com"); //----------------------------------------------------------- // Add values for transaction settings //----------------------------------------------------------- $duplicateWindowSetting = new AnetAPI\SettingType(); $duplicateWindowSetting-&gt;setSettingName("duplicateWindow"); $duplicateWindowSetting-&gt;setSettingValue("60"); //----------------------------------------------------------- // Add some merchant defined fields. These fields won't be // stored with the transaction,but will be echoed back in the response. //----------------------------------------------------------- $merchantDefinedField1 = new AnetAPI\UserFieldType(); $merchantDefinedField1-&gt;setName("customerLoyaltyNum"); $merchantDefinedField1-&gt;setValue("1128836273"); $merchantDefinedField2 = new AnetAPI\UserFieldType(); $merchantDefinedField2-&gt;setName("favoriteColor"); $merchantDefinedField2-&gt;setValue("blue"); //----------------------------------------------------------- // Create a TransactionRequestType object and add the previous objects to it //----------------------------------------------------------- $transactionRequestType = new AnetAPI\TransactionRequestType(); $transactionRequestType-&gt;setTransactionType("authOnlyTransaction"); $transactionRequestType-&gt;setAmount($amount); $transactionRequestType-&gt;setOrder($order); $transactionRequestType-&gt;setPayment($paymentOne); $transactionRequestType-&gt;setBillTo($customerAddress); $transactionRequestType-&gt;setCustomer($customerData); $transactionRequestType-&gt;addToTransactionSettings($duplicateWindowSetting); $transactionRequestType-&gt;addToUserFields($merchantDefinedField1); $transactionRequestType-&gt;addToUserFields($merchantDefinedField2); //----------------------------------------------------------- // Assemble the complete transaction request //----------------------------------------------------------- $request = new AnetAPI\CreateTransactionRequest(); $request-&gt;setMerchantAuthentication($merchantAuthentication); $request-&gt;setRefId($refId); $request-&gt;setTransactionRequest($transactionRequestType); //----------------------------------------------------------- // Create the controller and get the response //----------------------------------------------------------- $controller = new AnetController\CreateTransactionController($request); $response = $controller-&gt;executeWithApiResponse( et\authorize\api\constants\ANetEnvironment::SANDBOX); if ($response != null) { // Check to see if the API request was successfully received and acted upon if ($response-&gt;getMessages()-&gt;getResultCode() == "Ok") { // Since the API request was successful, look for a transaction response // and parse it to display the results of authorizing the card $tresponse = $response-&gt;getTransactionResponse(); if ($tresponse != null &amp;&amp; $tresponse-&gt;getMessages() != null) { echo " Successfully created transaction with Transaction ID: " . $tresponse-&gt;getTransId() . " "; echo " Transaction Response Code: " . $tresponse-&gt;getResponseCode() . " "; echo " Message Code: " . $tresponse-&gt;getMessages()[0]-&gt;getCode() . " "; echo " Auth Code: " . $tresponse-&gt;getAuthCode() . " "; echo " Description: " . $tresponse-&gt;getMessages()[0]-&gt;getDescription() . " "; } else { echo "Transaction Failed "; if ($tresponse-&gt;getErrors() != null) { echo " Error Code : " . $tresponse-&gt;getErrors()[0]-&gt;getErrorCode() . " "; echo " Error Message : " . $tresponse-&gt;getErrors()[0]-&gt;getErrorText() . " "; } } } else { echo "Transaction Failed "; $tresponse = $response-&gt;getTransactionResponse(); if ($tresponse != null &amp;&amp; $tresponse-&gt;getErrors() != null) { echo " Error Code : " . $tresponse-&gt;getErrors()[0]-&gt;getErrorCode() . " "; echo " Error Message : " . $tresponse-&gt;getErrors()[0]-&gt;getErrorText() . " "; } else { echo " Error Code : " . $response-&gt;getMessages()-&gt;getMessage()[0]-&gt;getCode() . " "; echo " Error Message : " . $response-&gt;getMessages()-&gt;getMessage()[0]-&gt;getText() . " "; } } } else { echo "No response returned "; } return $response; } </code></pre> <p>RETURNED PAGE SOURCE:</p> <pre class="lang-html prettyprint-override"><code> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"&gt; &lt;meta http-equiv="X-UA-Compatible" content="IE=edge" /&gt; &lt;meta charset="utf-8"&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0"&gt; &lt;head id="Head1"&gt;&lt;title&gt; Secure Information &lt;/title&gt; &lt;!-- Google Tag Manager --&gt; &lt;script&gt;(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&amp;l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-KFWQGNC');&lt;/script&gt; &lt;!-- End Google Tag Manager --&gt; &lt;script src="https://sandbox-assets.secure.checkout.visa.com/checkout-widget/resources/js/integration/v1/sdk.js" type="text/javascript" &gt; &lt;/script&gt; &lt;script type="text/javascript"&gt; var g_token = "null"; var g_merchantData = null; var g_pageOptions = null; var g_paymentProfiles = null; var g_maxPaymentProfiles = false; var g_errorPanelMessage = "The page has timed out. Please go back to the beginning and try again."; var g_siteKey = "6Lc8tgYAAAAAAFfalsuPuIZ6bv_2dGT_Y9ZxURiK"; var g_visaCheckoutUrl = "https://sandbox.secure.checkout.visa.com/wallet-services-web/xo/button.png"; &lt;/script&gt; &lt;script type="text/javascript"&gt; var g_EcheckEnabled = false; var g_CreditEnabled = false; &lt;/script&gt; &lt;base href="./Scripts/v1/"&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="PageOuter" id="divPageOuter"&gt; &lt;div id="divPopupScreen" class="PopupScreen" style="display:none;"&gt;&lt;/div&gt; &lt;div class="Page" id="divPage"&gt; &lt;div class="PageMain container" id="divPageMain container"&gt; &lt;!-- Google Tag Manager (noscript) --&gt; &lt;noscript&gt;&lt;iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KFWQGNC" height="0" width="0" style="display:none;visibility:hidden"&gt;&lt;/iframe&gt;&lt;/noscript&gt; &lt;!-- End Google Tag Manager (noscript) --&gt; &lt;app-accept-payment&gt;&lt;/app-accept-payment&gt; &lt;link href="styles.bundle.css" rel="stylesheet"/&gt; &lt;script type="text/javascript" src="inline.bundle.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="polyfills.bundle.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="scripts.bundle.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="main.bundle.js"&gt;&lt;/script&gt; &lt;/div&gt; &lt;div class="PageMainAfter"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> </div>

DELPHI如何通过VISA与USB设备通信

Private Sub Command1_Click() Dim defrm As Long Dim vi As Long ' 获得visa的usb资源 Call viOpenDefaultRM(defrm) ' 打开设备 Call viOpen(defrm, "USB0::0x1AB1::0x0E11::DP8F192200227::INSTR", 0, 0, vi) '发送设置命令 Call viVPrintf(vi, ":OUTP CH1,ON" + Chr$(10), 0) ' 关闭资源 Call viClose(vi) Call viClose(defrm) End Sub 以上是VB编写的通过USB控制DP831直流电源的程序,测试没问题。但我将该段代码转换成Delphi后,运行报错,请高手指点下迷津!以下是我的Delphi代码 function viOpenDefaultRM(sesn1:PLongint):Longint;stdcall external 'visa32.dll'; function viOpen(sesn1:PLongint;rsrcName:PChar;acessMode:Longint;timeout:Longint;sesn2:PLongint):Longint;stdcall external 'visa32.dll'; function viPrintf( vi:PLongint; writeFmt:pchar;ss:Longint): integer; Cdecl; external 'VISA32.DLL' ; function viClose(sesn:PLongint):Longint;stdcall external 'visa32.dll'; procedure TForm1.Button1Click(Sender: TObject); var defrm,vi:PLongint; begin // 获得visa的usb资源 viOpenDefaultRM(defrm); //打开设备 viOpen(defrm,'USB0::0x1AB1::0x0E11::DP8F192200227::INSTR', 0, 0, vi); //发送设置命令 viPrintf(vi,':OUTP CH1,ON'+#10, 0); viClose(vi); viClose(defrm); end; 不知是哪里出了问题?

VC中使用VISA读示波器数据

用VISA的viRead读示波器内存的波形数据,设置的每次读数据个数1024个,内存中有数据10240个,循环调用viRead时,第一次能返回1024个数据,但第二次以后就读不到了,为什么? 还有,viRead读到的数据格式是"#90000xxxxxmmmm…"其中#90000xxxxx是数据头,xxxxx代表读到的数据点数,mmmmm…是二进制数据。我往.csv文件里写这些数据时用fstream的write(),写进去还是图一这样的,我想要的是数字。怎么回事? 还有就是程序只有在调试状态下单步执行viRead才能返回数据,直接运行就提示超时,怎么回事?![图片说明](https://img-ask.csdn.net/upload/201711/14/1510625005_420167.png)

用Paypal连接我的网站

<div class="post-text" itemprop="text"> <p>I'm trying to connect my website with paypal.Have passed on the total amount which have set it in session and on running the setexpresscheckout.php i'm getting this error </p> <p><code>'SetExpressCheckout API call failed. Detailed Error Message: Security header is not validShort Error Message: Security errorError Code: 10002Error Severity Code: Error'</code> </p> <p>How can i solve this problem</p> <p>This is the paypal expresscheckout.php</p> <pre><code>&lt;?php $order_price=''; if(isset($_POST['order_price'])){ $order_price= $_POST['order_price']; } ?&gt; &lt;?php require_once ("paypalfunctions.php"); // ================================== // PayPal Express Checkout Module // ================================== //'------------------------------------ //' The paymentAmount is the total value of //' the shopping cart, that was set //' earlier in a session variable //' by the shopping cart page //'------------------------------------ $paymentAmount = $order_price; //'------------------------------------ //' The currencyCodeType and paymentType //' are set to the selections made on the Integration Assistant //'------------------------------------ $currencyCodeType = "USD"; $paymentType = "Sale"; //'------------------------------------ //' The returnURL is the location where buyers return to when a //' payment has been succesfully authorized. //' //' This is set to the value entered on the Integration Assistant //'------------------------------------ $returnURL = "http://localhost/culdesign.preview/PayOrder.php"; //'------------------------------------ //' The cancelURL is the location buyers are sent to when they hit the //' cancel button during authorization of payment during the PayPal flow //' //' This is set to the value entered on the Integration Assistant //'------------------------------------ $cancelURL = "http://localhost/culdesign.preview/PlaceAnOrder.php"; //'------------------------------------ //' Calls the SetExpressCheckout API call //' //' The CallShortcutExpressCheckout function is defined in the file PayPalFunctions.php, //' it is included at the top of this file. //'------------------------------------------------- $resArray = CallShortcutExpressCheckout ($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL); $ack = strtoupper($resArray["ACK"]); if($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING") { RedirectToPayPal ( $resArray["TOKEN"] ); } else { //Display a user friendly Error on the page using any of the following error information returned by PayPal $ErrorCode = urldecode($resArray["L_ERRORCODE0"]); $ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]); $ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]); $ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]); echo "SetExpressCheckout API call failed. "; echo "Detailed Error Message: " . $ErrorLongMsg; echo "Short Error Message: " . $ErrorShortMsg; echo "Error Code: " . $ErrorCode; echo "Error Severity Code: " . $ErrorSeverityCode; } ?&gt; </code></pre> <p>The code below is the paypalfunction.php</p> <pre><code>&lt;?php /******************************************** PayPal API Module Defines all the global variables and the wrapper functions ********************************************/ $PROXY_HOST = '127.0.0.1'; $PROXY_PORT = '808'; $SandboxFlag = true; //'------------------------------------ //' PayPal API Credentials //' Replace &lt;API_USERNAME&gt; with your API Username //' Replace &lt;API_PASSWORD&gt; with your API Password //' Replace &lt;API_SIGNATURE&gt; with your Signature //'------------------------------------ $API_UserName="&lt;ytech008_api1.gmail.com&gt;"; $API_Password="&lt;WV6C69HAB5844H6S&gt;"; $API_Signature="&lt;AAv5.GyV.pgCRwdV-5hnE5G.F8BwAs81G0tx7YR7-B6ao3PiSeCn-kvN&gt;"; // BN Code is only applicable for partners $sBNCode = "PP-ECWizard"; /* ' Define the PayPal Redirect URLs. ' This is the URL that the buyer is first sent to do authorize payment with their paypal account ' change the URL depending if you are testing on the sandbox or the live PayPal site ' ' For the sandbox, the URL is https://www.sandbox.paypal.com/webscr&amp;cmd=_express-checkout&amp;token= ' For the live site, the URL is https://www.paypal.com/webscr&amp;cmd=_express-checkout&amp;token= */ if ($SandboxFlag == true) { $API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp"; $PAYPAL_URL = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&amp;token="; } else { $API_Endpoint = "https://api-3t.paypal.com/nvp"; $PAYPAL_URL = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&amp;token="; } $USE_PROXY = false; $version="93"; if (session_id() == "") session_start(); /* An express checkout transaction starts with a token, that identifies to PayPal your transaction In this example, when the script sees a token, the script knows that the buyer has already authorized payment through paypal. If no token was found, the action is to send the buyer to PayPal to first authorize payment */ /* '------------------------------------------------------------------------------------------------------------------------------------------- ' Purpose: Prepares the parameters for the SetExpressCheckout API Call. ' Inputs: ' paymentAmount: Total value of the shopping cart ' currencyCodeType: Currency code value the PayPal API ' paymentType: paymentType has to be one of the following values: Sale or Order or Authorization ' returnURL: the page where buyers return to after they are done with the payment review on PayPal ' cancelURL: the page where buyers return to when they cancel the payment review on PayPal '-------------------------------------------------------------------------------------------------------------------------------------------- */ function CallShortcutExpressCheckout( $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL) { //------------------------------------------------------------------------------------------------------------------------------------ // Construct the parameter string that describes the SetExpressCheckout API call in the shortcut implementation $nvpstr="&amp;PAYMENTREQUEST_0_AMT=". $paymentAmount; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_PAYMENTACTION=" . $paymentType; $nvpstr = $nvpstr . "&amp;RETURNURL=" . $returnURL; $nvpstr = $nvpstr . "&amp;CANCELURL=" . $cancelURL; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_CURRENCYCODE=" . $currencyCodeType; $_SESSION["currencyCodeType"] = $currencyCodeType; $_SESSION["PaymentType"] = $paymentType; //'--------------------------------------------------------------------------------------------------------------- //' Make the API call to PayPal //' If the API call succeded, then redirect the buyer to PayPal to begin to authorize payment. //' If an error occured, show the resulting errors //'--------------------------------------------------------------------------------------------------------------- $resArray=hash_call("SetExpressCheckout", $nvpstr); $ack = strtoupper($resArray["ACK"]); if($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING") { $token = urldecode($resArray["TOKEN"]); $_SESSION['TOKEN']=$token; } return $resArray; } /* '------------------------------------------------------------------------------------------------------------------------------------------- ' Purpose: Prepares the parameters for the SetExpressCheckout API Call. ' Inputs: ' paymentAmount: Total value of the shopping cart ' currencyCodeType: Currency code value the PayPal API ' paymentType: paymentType has to be one of the following values: Sale or Order or Authorization ' returnURL: the page where buyers return to after they are done with the payment review on PayPal ' cancelURL: the page where buyers return to when they cancel the payment review on PayPal ' shipToName: the Ship to name entered on the merchant's site ' shipToStreet: the Ship to Street entered on the merchant's site ' shipToCity: the Ship to City entered on the merchant's site ' shipToState: the Ship to State entered on the merchant's site ' shipToCountryCode: the Code for Ship to Country entered on the merchant's site ' shipToZip: the Ship to ZipCode entered on the merchant's site ' shipToStreet2: the Ship to Street2 entered on the merchant's site ' phoneNum: the phoneNum entered on the merchant's site '-------------------------------------------------------------------------------------------------------------------------------------------- */ function CallMarkExpressCheckout( $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum ) { //------------------------------------------------------------------------------------------------------------------------------------ // Construct the parameter string that describes the SetExpressCheckout API call in the shortcut implementation $nvpstr="&amp;PAYMENTREQUEST_0_AMT=". $paymentAmount; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_PAYMENTACTION=" . $paymentType; $nvpstr = $nvpstr . "&amp;RETURNURL=" . $returnURL; $nvpstr = $nvpstr . "&amp;CANCELURL=" . $cancelURL; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_CURRENCYCODE=" . $currencyCodeType; $nvpstr = $nvpstr . "&amp;ADDROVERRIDE=1"; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_SHIPTONAME=" . $shipToName; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_SHIPTOSTREET=" . $shipToStreet; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_SHIPTOSTREET2=" . $shipToStreet2; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_SHIPTOCITY=" . $shipToCity; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_SHIPTOSTATE=" . $shipToState; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE=" . $shipToCountryCode; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_SHIPTOZIP=" . $shipToZip; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_SHIPTOPHONENUM=" . $phoneNum; $_SESSION["currencyCodeType"] = $currencyCodeType; $_SESSION["PaymentType"] = $paymentType; //'--------------------------------------------------------------------------------------------------------------- //' Make the API call to PayPal //' If the API call succeded, then redirect the buyer to PayPal to begin to authorize payment. //' If an error occured, show the resulting errors //'--------------------------------------------------------------------------------------------------------------- $resArray=hash_call("SetExpressCheckout", $nvpstr); $ack = strtoupper($resArray["ACK"]); if($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING") { $token = urldecode($resArray["TOKEN"]); $_SESSION['TOKEN']=$token; } return $resArray; } /* '------------------------------------------------------------------------------------------- ' Purpose: Prepares the parameters for the GetExpressCheckoutDetails API Call. ' ' Inputs: ' None ' Returns: ' The NVP Collection object of the GetExpressCheckoutDetails Call Response. '------------------------------------------------------------------------------------------- */ function GetShippingDetails( $token ) { //'-------------------------------------------------------------- //' At this point, the buyer has completed authorizing the payment //' at PayPal. The function will call PayPal to obtain the details //' of the authorization, incuding any shipping information of the //' buyer. Remember, the authorization is not a completed transaction //' at this state - the buyer still needs an additional step to finalize //' the transaction //'-------------------------------------------------------------- //'--------------------------------------------------------------------------- //' Build a second API request to PayPal, using the token as the //' ID to get the details on the payment authorization //'--------------------------------------------------------------------------- $nvpstr="&amp;TOKEN=" . $token; //'--------------------------------------------------------------------------- //' Make the API call and store the results in an array. //' If the call was a success, show the authorization details, and provide //' an action to complete the payment. //' If failed, show the error //'--------------------------------------------------------------------------- $resArray=hash_call("GetExpressCheckoutDetails",$nvpstr); $ack = strtoupper($resArray["ACK"]); if($ack == "SUCCESS" || $ack=="SUCCESSWITHWARNING") { $_SESSION['payer_id'] = $resArray['PAYERID']; } return $resArray; } /* '------------------------------------------------------------------------------------------------------------------------------------------- ' Purpose: Prepares the parameters for the GetExpressCheckoutDetails API Call. ' ' Inputs: ' sBNCode: The BN code used by PayPal to track the transactions from a given shopping cart. ' Returns: ' The NVP Collection object of the GetExpressCheckoutDetails Call Response. '-------------------------------------------------------------------------------------------------------------------------------------------- */ function ConfirmPayment( $FinalPaymentAmt ) { /* Gather the information to make the final call to finalize the PayPal payment. The variable nvpstr holds the name value pairs */ //Format the other parameters that were stored in the session from the previous calls $token = urlencode($_SESSION['TOKEN']); $paymentType = urlencode($_SESSION['PaymentType']); $currencyCodeType = urlencode($_SESSION['currencyCodeType']); $payerID = urlencode($_SESSION['payer_id']); $serverName = urlencode($_SERVER['SERVER_NAME']); $nvpstr = '&amp;TOKEN=' . $token . '&amp;PAYERID=' . $payerID . '&amp;PAYMENTREQUEST_0_PAYMENTACTION=' . $paymentType . '&amp;PAYMENTREQUEST_0_AMT=' . $FinalPaymentAmt; $nvpstr .= '&amp;PAYMENTREQUEST_0_CURRENCYCODE=' . $currencyCodeType . '&amp;IPADDRESS=' . $serverName; /* Make the call to PayPal to finalize payment If an error occured, show the resulting errors */ $resArray=hash_call("DoExpressCheckoutPayment",$nvpstr); /* Display the API response back to the browser. If the response from PayPal was a success, display the response parameters' If the response was an error, display the errors received using APIError.php. */ $ack = strtoupper($resArray["ACK"]); return $resArray; } /* '------------------------------------------------------------------------------------------------------------------------------------------- ' Purpose: This function makes a DoDirectPayment API call ' ' Inputs: ' paymentType: paymentType has to be one of the following values: Sale or Order or Authorization ' paymentAmount: total value of the shopping cart ' currencyCode: currency code value the PayPal API ' firstName: first name as it appears on credit card ' lastName: last name as it appears on credit card ' street: buyer's street address line as it appears on credit card ' city: buyer's city ' state: buyer's state ' countryCode: buyer's country code ' zip: buyer's zip ' creditCardType: buyer's credit card type (i.e. Visa, MasterCard ... ) ' creditCardNumber: buyers credit card number without any spaces, dashes or any other characters ' expDate: credit card expiration date ' cvv2: Card Verification Value ' '------------------------------------------------------------------------------------------- ' ' Returns: ' The NVP Collection object of the DoDirectPayment Call Response. '-------------------------------------------------------------------------------------------------------------------------------------------- */ function DirectPayment( $paymentType, $paymentAmount, $creditCardType, $creditCardNumber, $expDate, $cvv2, $firstName, $lastName, $street, $city, $state, $zip, $countryCode, $currencyCode ) { //Construct the parameter string that describes DoDirectPayment $nvpstr = "&amp;AMT=" . $paymentAmount; $nvpstr = $nvpstr . "&amp;CURRENCYCODE=" . $currencyCode; $nvpstr = $nvpstr . "&amp;PAYMENTACTION=" . $paymentType; $nvpstr = $nvpstr . "&amp;CREDITCARDTYPE=" . $creditCardType; $nvpstr = $nvpstr . "&amp;ACCT=" . $creditCardNumber; $nvpstr = $nvpstr . "&amp;EXPDATE=" . $expDate; $nvpstr = $nvpstr . "&amp;CVV2=" . $cvv2; $nvpstr = $nvpstr . "&amp;FIRSTNAME=" . $firstName; $nvpstr = $nvpstr . "&amp;LASTNAME=" . $lastName; $nvpstr = $nvpstr . "&amp;STREET=" . $street; $nvpstr = $nvpstr . "&amp;CITY=" . $city; $nvpstr = $nvpstr . "&amp;STATE=" . $state; $nvpstr = $nvpstr . "&amp;COUNTRYCODE=" . $countryCode; $nvpstr = $nvpstr . "&amp;IPADDRESS=" . $_SERVER['REMOTE_ADDR']; $resArray=hash_call("DoDirectPayment", $nvpstr); return $resArray; } /** '------------------------------------------------------------------------------------------------------------------------------------------- * hash_call: Function to perform the API call to PayPal using API signature * @methodName is name of API method. * @nvpStr is nvp string. * returns an associtive array containing the response from the server. '------------------------------------------------------------------------------------------------------------------------------------------- */ function hash_call($methodName,$nvpStr) { //declaring of global variables global $API_Endpoint, $version, $API_UserName, $API_Password, $API_Signature; global $USE_PROXY, $PROXY_HOST, $PROXY_PORT; global $gv_ApiErrorURL; global $sBNCode; //setting the curl parameters. $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$API_Endpoint); curl_setopt($ch, CURLOPT_VERBOSE, 1); //turning off the server and peer verification(TrustManager Concept). curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_POST, 1); //if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled. //Set proxy name to PROXY_HOST and port number to PROXY_PORT in constants.php if($USE_PROXY) curl_setopt ($ch, CURLOPT_PROXY, $PROXY_HOST. ":" . $PROXY_PORT); //NVPRequest for submitting to server $nvpreq="METHOD=" . urlencode($methodName) . "&amp;VERSION=" . urlencode($version) . "&amp;PWD=" . urlencode($API_Password) . "&amp;USER=" . urlencode($API_UserName) . "&amp;SIGNATURE=" . urlencode($API_Signature) . $nvpStr . "&amp;BUTTONSOURCE=" . urlencode($sBNCode); //setting the nvpreq as POST FIELD to curl curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq); //getting response from server $response = curl_exec($ch); //convrting NVPResponse to an Associative Array $nvpResArray=deformatNVP($response); $nvpReqArray=deformatNVP($nvpreq); $_SESSION['nvpReqArray']=$nvpReqArray; if (curl_errno($ch)) { // moving to display page to display curl errors $_SESSION['curl_error_no']=curl_errno($ch) ; $_SESSION['curl_error_msg']=curl_error($ch); //Execute the Error handling module to display errors. } else { //closing the curl curl_close($ch); } return $nvpResArray; } /*'---------------------------------------------------------------------------------- Purpose: Redirects to PayPal.com site. Inputs: NVP string. Returns: ---------------------------------------------------------------------------------- */ function RedirectToPayPal ( $token ) { global $PAYPAL_URL; // Redirect to paypal.com here $payPalURL = $PAYPAL_URL . $token; header("Location: ".$payPalURL); exit; } /*'---------------------------------------------------------------------------------- * This function will take NVPString and convert it to an Associative Array and it will decode the response. * It is usefull to search for a particular key and displaying arrays. * @nvpstr is NVPString. * @nvpArray is Associative Array. ---------------------------------------------------------------------------------- */ function deformatNVP($nvpstr) { $intial=0; $nvpArray = array(); while(strlen($nvpstr)) { //postion of Key $keypos= strpos($nvpstr,'='); //position of value $valuepos = strpos($nvpstr,'&amp;') ? strpos($nvpstr,'&amp;'): strlen($nvpstr); /*getting the Key and Value values and storing in a Associative Array*/ $keyval=substr($nvpstr,$intial,$keypos); $valval=substr($nvpstr,$keypos+1,$valuepos-$keypos-1); //decoding the respose $nvpArray[urldecode($keyval)] =urldecode( $valval); $nvpstr=substr($nvpstr,$valuepos+1,strlen($nvpstr)); } return $nvpArray; } ?&gt; </code></pre> </div>

c#中使用ivi.visanet编程scanfarray的用法。

最近在用c#编程,其中使用ivi.visa控制相关仪器,但是根据帮助文档中使用scanfarray方法读取仪器中的数据并存储在创建的数组中显示错误 ![图片说明](https://img-ask.csdn.net/upload/201812/05/1543997059_764472.png) 上图是帮助文档中的方法说明 ![图片说明](https://img-ask.csdn.net/upload/201812/05/1543997177_143810.png) 这段是出问题的代码,有没有哪位大神了解问题出在哪里

PHP paypal快速结账集成总是收取1GBP

<div class="post-text" itemprop="text"> <p>This is my first time trying to integrate paypal express checkout into a plugin so bear with me.</p> <p>My aim is simple, I have a question form, when a user clicks on submit, they are taken to Paypal where they pay a fixed amount (let's say 0.1 USD), on successful payment they are sent back to the question form where their question is submitted. i.e The user has to pay to submit a question.</p> <p>I went through the paypal integration wizard for Paypal Express, however it is trying to get me to set up a cart, billing, confirm and review page which is total overkill for what I'm trying to do. </p> <p>Here is the current code I have. Here is my question form:</p> <pre><code>&lt;?php $_SESSION['Payment_Amount'] = "0.1"; ?&gt; &lt;div id="askme"&gt; &lt;form id="newask" name="newask" method="post" action="&lt;?php echo plugin_dir_url( __FILE__ ); ?&gt;expresscheckout.php"&gt; &lt;label for="question" id="questionLabel"&gt;&lt;?php _e('Your video question link:', 'askme-plugin'); ?&gt;&lt;/label&gt;&lt;br /&gt; &lt;input type="text" id="question" value="" tabindex="1" size="20" name="question" /&gt; &lt;p&gt;&lt;input type="submit" class="btn btn-primary" value="Pay and Submit Your Question" tabindex="6" id="submit" name="submit" /&gt;&lt;/p&gt; &lt;input type="hidden" name="post_type" id="post_type" value="askme" /&gt; &lt;input type="hidden" name="action" value="post" /&gt; &lt;?php wp_nonce_field( 'new-post' ); ?&gt; &lt;/form&gt; &lt;/div&gt; </code></pre> <p>Then in expresscheckout.php I have:</p> <pre><code>&lt;?php require_once ("paypalfunctions.php"); $paymentAmount = $_SESSION["Payment_Amount"]; $currencyCodeType = "USD"; $paymentType = "Sale"; $returnURL = "http://www.jamespaynedrums.com/ask-a-question/ask-a-question-2?question_confirm=1"; $cancelURL = "http://www.jamespaynedrums.com/ask-a-question/ask-a-question-2?question_cancel=1"; //'------------------------------------ //' Calls the SetExpressCheckout API call //' //' The CallShortcutExpressCheckout function is defined in the file PayPalFunctions.php, //' it is included at the top of this file. //'------------------------------------------------- $resArray = CallShortcutExpressCheckout ($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL); $ack = strtoupper($resArray["ACK"]); if($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING") { RedirectToPayPal ( $resArray["TOKEN"] ); } else { //Display a user friendly Error on the page using any of the following error information returned by PayPal $ErrorCode = urldecode($resArray["L_ERRORCODE0"]); $ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]); $ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]); $ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]); echo "SetExpressCheckout API call failed. "; echo "Detailed Error Message: " . $ErrorLongMsg; echo "Short Error Message: " . $ErrorShortMsg; echo "Error Code: " . $ErrorCode; echo "Error Severity Code: " . $ErrorSeverityCode; } ?&gt; </code></pre> <p>and finally in paypalfunctions.php (required in expresscheckout.php) I have (with API creds blocked out)</p> <pre><code>&lt;?php /******************************************** PayPal API Module Defines all the global variables and the wrapper functions ********************************************/ $PROXY_HOST = '127.0.0.1'; $PROXY_PORT = '808'; $SandboxFlag = false; //'------------------------------------ //' PayPal API Credentials //' Replace &lt;API_USERNAME&gt; with your API Username //' Replace &lt;API_PASSWORD&gt; with your API Password //' Replace &lt;API_SIGNATURE&gt; with your Signature //'------------------------------------ $API_UserName="**BLANKED OUT**"; $API_Password="**BLANKED OUT**"; $API_Signature="**BLANKED OUT**"; // BN Code is only applicable for partners $sBNCode = "PP-ECWizard"; /* ' Define the PayPal Redirect URLs. ' This is the URL that the buyer is first sent to do authorize payment with their paypal account ' change the URL depending if you are testing on the sandbox or the live PayPal site ' ' For the sandbox, the URL is https://www.sandbox.paypal.com/webscr&amp;cmd=_express-checkout&amp;token= ' For the live site, the URL is https://www.paypal.com/webscr&amp;cmd=_express-checkout&amp;token= */ if ($SandboxFlag == true) { $API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp"; $PAYPAL_URL = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&amp;token="; } else { $API_Endpoint = "https://api-3t.paypal.com/nvp"; $PAYPAL_URL = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&amp;token="; } $USE_PROXY = false; $version="93"; if (session_id() == "") session_start(); /* An express checkout transaction starts with a token, that identifies to PayPal your transaction In this example, when the script sees a token, the script knows that the buyer has already authorized payment through paypal. If no token was found, the action is to send the buyer to PayPal to first authorize payment */ /* '------------------------------------------------------------------------------------------------------------------------------------------- ' Purpose: Prepares the parameters for the SetExpressCheckout API Call. ' Inputs: ' paymentAmount: Total value of the shopping cart ' currencyCodeType: Currency code value the PayPal API ' paymentType: paymentType has to be one of the following values: Sale or Order or Authorization ' returnURL: the page where buyers return to after they are done with the payment review on PayPal ' cancelURL: the page where buyers return to when they cancel the payment review on PayPal '-------------------------------------------------------------------------------------------------------------------------------------------- */ function CallShortcutExpressCheckout( $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL) { //------------------------------------------------------------------------------------------------------------------------------------ // Construct the parameter string that describes the SetExpressCheckout API call in the shortcut implementation $nvpstr="&amp;PAYMENTREQUEST_0_AMT=". $paymentAmount; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_PAYMENTACTION=" . $paymentType; $nvpstr = $nvpstr . "&amp;RETURNURL=" . $returnURL; $nvpstr = $nvpstr . "&amp;CANCELURL=" . $cancelURL; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_CURRENCYCODE=" . $currencyCodeType; $_SESSION["currencyCodeType"] = $currencyCodeType; $_SESSION["PaymentType"] = $paymentType; //'--------------------------------------------------------------------------------------------------------------- //' Make the API call to PayPal //' If the API call succeded, then redirect the buyer to PayPal to begin to authorize payment. //' If an error occured, show the resulting errors //'--------------------------------------------------------------------------------------------------------------- $resArray=hash_call("SetExpressCheckout", $nvpstr); $ack = strtoupper($resArray["ACK"]); if($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING") { $token = urldecode($resArray["TOKEN"]); $_SESSION['TOKEN']=$token; } return $resArray; } /* '------------------------------------------------------------------------------------------------------------------------------------------- ' Purpose: Prepares the parameters for the SetExpressCheckout API Call. ' Inputs: ' paymentAmount: Total value of the shopping cart ' currencyCodeType: Currency code value the PayPal API ' paymentType: paymentType has to be one of the following values: Sale or Order or Authorization ' returnURL: the page where buyers return to after they are done with the payment review on PayPal ' cancelURL: the page where buyers return to when they cancel the payment review on PayPal ' shipToName: the Ship to name entered on the merchant's site ' shipToStreet: the Ship to Street entered on the merchant's site ' shipToCity: the Ship to City entered on the merchant's site ' shipToState: the Ship to State entered on the merchant's site ' shipToCountryCode: the Code for Ship to Country entered on the merchant's site ' shipToZip: the Ship to ZipCode entered on the merchant's site ' shipToStreet2: the Ship to Street2 entered on the merchant's site ' phoneNum: the phoneNum entered on the merchant's site '-------------------------------------------------------------------------------------------------------------------------------------------- */ function CallMarkExpressCheckout( $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum ) { //------------------------------------------------------------------------------------------------------------------------------------ // Construct the parameter string that describes the SetExpressCheckout API call in the shortcut implementation $nvpstr="&amp;PAYMENTREQUEST_0_AMT=". $paymentAmount; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_PAYMENTACTION=" . $paymentType; $nvpstr = $nvpstr . "&amp;RETURNURL=" . $returnURL; $nvpstr = $nvpstr . "&amp;CANCELURL=" . $cancelURL; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_CURRENCYCODE=" . $currencyCodeType; $nvpstr = $nvpstr . "&amp;ADDROVERRIDE=1"; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_SHIPTONAME=" . $shipToName; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_SHIPTOSTREET=" . $shipToStreet; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_SHIPTOSTREET2=" . $shipToStreet2; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_SHIPTOCITY=" . $shipToCity; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_SHIPTOSTATE=" . $shipToState; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE=" . $shipToCountryCode; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_SHIPTOZIP=" . $shipToZip; $nvpstr = $nvpstr . "&amp;PAYMENTREQUEST_0_SHIPTOPHONENUM=" . $phoneNum; $_SESSION["currencyCodeType"] = $currencyCodeType; $_SESSION["PaymentType"] = $paymentType; //'--------------------------------------------------------------------------------------------------------------- //' Make the API call to PayPal //' If the API call succeded, then redirect the buyer to PayPal to begin to authorize payment. //' If an error occured, show the resulting errors //'--------------------------------------------------------------------------------------------------------------- $resArray=hash_call("SetExpressCheckout", $nvpstr); $ack = strtoupper($resArray["ACK"]); if($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING") { $token = urldecode($resArray["TOKEN"]); $_SESSION['TOKEN']=$token; } return $resArray; } /* '------------------------------------------------------------------------------------------- ' Purpose: Prepares the parameters for the GetExpressCheckoutDetails API Call. ' ' Inputs: ' None ' Returns: ' The NVP Collection object of the GetExpressCheckoutDetails Call Response. '------------------------------------------------------------------------------------------- */ function GetShippingDetails( $token ) { //'-------------------------------------------------------------- //' At this point, the buyer has completed authorizing the payment //' at PayPal. The function will call PayPal to obtain the details //' of the authorization, incuding any shipping information of the //' buyer. Remember, the authorization is not a completed transaction //' at this state - the buyer still needs an additional step to finalize //' the transaction //'-------------------------------------------------------------- //'--------------------------------------------------------------------------- //' Build a second API request to PayPal, using the token as the //' ID to get the details on the payment authorization //'--------------------------------------------------------------------------- $nvpstr="&amp;TOKEN=" . $token; //'--------------------------------------------------------------------------- //' Make the API call and store the results in an array. //' If the call was a success, show the authorization details, and provide //' an action to complete the payment. //' If failed, show the error //'--------------------------------------------------------------------------- $resArray=hash_call("GetExpressCheckoutDetails",$nvpstr); $ack = strtoupper($resArray["ACK"]); if($ack == "SUCCESS" || $ack=="SUCCESSWITHWARNING") { $_SESSION['payer_id'] = $resArray['PAYERID']; } return $resArray; } /* '------------------------------------------------------------------------------------------------------------------------------------------- ' Purpose: Prepares the parameters for the GetExpressCheckoutDetails API Call. ' ' Inputs: ' sBNCode: The BN code used by PayPal to track the transactions from a given shopping cart. ' Returns: ' The NVP Collection object of the GetExpressCheckoutDetails Call Response. '-------------------------------------------------------------------------------------------------------------------------------------------- */ function ConfirmPayment( $FinalPaymentAmt ) { /* Gather the information to make the final call to finalize the PayPal payment. The variable nvpstr holds the name value pairs */ //Format the other parameters that were stored in the session from the previous calls $token = urlencode($_SESSION['TOKEN']); $paymentType = urlencode($_SESSION['PaymentType']); $currencyCodeType = urlencode($_SESSION['currencyCodeType']); $payerID = urlencode($_SESSION['payer_id']); $serverName = urlencode($_SERVER['SERVER_NAME']); $nvpstr = '&amp;TOKEN=' . $token . '&amp;PAYERID=' . $payerID . '&amp;PAYMENTREQUEST_0_PAYMENTACTION=' . $paymentType . '&amp;PAYMENTREQUEST_0_AMT=' . $FinalPaymentAmt; $nvpstr .= '&amp;PAYMENTREQUEST_0_CURRENCYCODE=' . $currencyCodeType . '&amp;IPADDRESS=' . $serverName; /* Make the call to PayPal to finalize payment If an error occured, show the resulting errors */ $resArray=hash_call("DoExpressCheckoutPayment",$nvpstr); /* Display the API response back to the browser. If the response from PayPal was a success, display the response parameters' If the response was an error, display the errors received using APIError.php. */ $ack = strtoupper($resArray["ACK"]); return $resArray; } /* '------------------------------------------------------------------------------------------------------------------------------------------- ' Purpose: This function makes a DoDirectPayment API call ' ' Inputs: ' paymentType: paymentType has to be one of the following values: Sale or Order or Authorization ' paymentAmount: total value of the shopping cart ' currencyCode: currency code value the PayPal API ' firstName: first name as it appears on credit card ' lastName: last name as it appears on credit card ' street: buyer's street address line as it appears on credit card ' city: buyer's city ' state: buyer's state ' countryCode: buyer's country code ' zip: buyer's zip ' creditCardType: buyer's credit card type (i.e. Visa, MasterCard ... ) ' creditCardNumber: buyers credit card number without any spaces, dashes or any other characters ' expDate: credit card expiration date ' cvv2: Card Verification Value ' '------------------------------------------------------------------------------------------- ' ' Returns: ' The NVP Collection object of the DoDirectPayment Call Response. '-------------------------------------------------------------------------------------------------------------------------------------------- */ function DirectPayment( $paymentType, $paymentAmount, $creditCardType, $creditCardNumber, $expDate, $cvv2, $firstName, $lastName, $street, $city, $state, $zip, $countryCode, $currencyCode ) { //Construct the parameter string that describes DoDirectPayment $nvpstr = "&amp;AMT=" . $paymentAmount; $nvpstr = $nvpstr . "&amp;CURRENCYCODE=" . $currencyCode; $nvpstr = $nvpstr . "&amp;PAYMENTACTION=" . $paymentType; $nvpstr = $nvpstr . "&amp;CREDITCARDTYPE=" . $creditCardType; $nvpstr = $nvpstr . "&amp;ACCT=" . $creditCardNumber; $nvpstr = $nvpstr . "&amp;EXPDATE=" . $expDate; $nvpstr = $nvpstr . "&amp;CVV2=" . $cvv2; $nvpstr = $nvpstr . "&amp;FIRSTNAME=" . $firstName; $nvpstr = $nvpstr . "&amp;LASTNAME=" . $lastName; $nvpstr = $nvpstr . "&amp;STREET=" . $street; $nvpstr = $nvpstr . "&amp;CITY=" . $city; $nvpstr = $nvpstr . "&amp;STATE=" . $state; $nvpstr = $nvpstr . "&amp;COUNTRYCODE=" . $countryCode; $nvpstr = $nvpstr . "&amp;IPADDRESS=" . $_SERVER['REMOTE_ADDR']; $resArray=hash_call("DoDirectPayment", $nvpstr); return $resArray; } /** '------------------------------------------------------------------------------------------------------------------------------------------- * hash_call: Function to perform the API call to PayPal using API signature * @methodName is name of API method. * @nvpStr is nvp string. * returns an associtive array containing the response from the server. '------------------------------------------------------------------------------------------------------------------------------------------- */ function hash_call($methodName,$nvpStr) { //declaring of global variables global $API_Endpoint, $version, $API_UserName, $API_Password, $API_Signature; global $USE_PROXY, $PROXY_HOST, $PROXY_PORT; global $gv_ApiErrorURL; global $sBNCode; //setting the curl parameters. $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$API_Endpoint); curl_setopt($ch, CURLOPT_VERBOSE, 1); //turning off the server and peer verification(TrustManager Concept). curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_POST, 1); //if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled. //Set proxy name to PROXY_HOST and port number to PROXY_PORT in constants.php if($USE_PROXY) curl_setopt ($ch, CURLOPT_PROXY, $PROXY_HOST. ":" . $PROXY_PORT); //NVPRequest for submitting to server $nvpreq="METHOD=" . urlencode($methodName) . "&amp;VERSION=" . urlencode($version) . "&amp;PWD=" . urlencode($API_Password) . "&amp;USER=" . urlencode($API_UserName) . "&amp;SIGNATURE=" . urlencode($API_Signature) . $nvpStr . "&amp;BUTTONSOURCE=" . urlencode($sBNCode); //setting the nvpreq as POST FIELD to curl curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq); //getting response from server $response = curl_exec($ch); //convrting NVPResponse to an Associative Array $nvpResArray=deformatNVP($response); $nvpReqArray=deformatNVP($nvpreq); $_SESSION['nvpReqArray']=$nvpReqArray; if (curl_errno($ch)) { // moving to display page to display curl errors $_SESSION['curl_error_no']=curl_errno($ch) ; $_SESSION['curl_error_msg']=curl_error($ch); //Execute the Error handling module to display errors. } else { //closing the curl curl_close($ch); } return $nvpResArray; } /*'---------------------------------------------------------------------------------- Purpose: Redirects to PayPal.com site. Inputs: NVP string. Returns: ---------------------------------------------------------------------------------- */ function RedirectToPayPal ( $token ) { global $PAYPAL_URL; // Redirect to paypal.com here $payPalURL = $PAYPAL_URL . $token; header("Location: ".$payPalURL); exit; } /*'---------------------------------------------------------------------------------- * This function will take NVPString and convert it to an Associative Array and it will decode the response. * It is usefull to search for a particular key and displaying arrays. * @nvpstr is NVPString. * @nvpArray is Associative Array. ---------------------------------------------------------------------------------- */ function deformatNVP($nvpstr) { $intial=0; $nvpArray = array(); while(strlen($nvpstr)) { //postion of Key $keypos= strpos($nvpstr,'='); //position of value $valuepos = strpos($nvpstr,'&amp;') ? strpos($nvpstr,'&amp;'): strlen($nvpstr); /*getting the Key and Value values and storing in a Associative Array*/ $keyval=substr($nvpstr,$intial,$keypos); $valval=substr($nvpstr,$keypos+1,$valuepos-$keypos-1); //decoding the respose $nvpArray[urldecode($keyval)] =urldecode( $valval); $nvpstr=substr($nvpstr,$valuepos+1,strlen($nvpstr)); } return $nvpArray; } ?&gt; </code></pre> <p>Currently, when I click on my form submit button, I am taken to paypal, I log in and it is trying to charge me 1GBP - not 0.1USD.</p> <p>Also worth mentioning that this is a wordpress plugin, and at the top of my file containing the form (askme.php) I have the following code:</p> <pre><code>add_action('init', 'myStartSession', 1); add_action('wp_logout', 'myEndSession'); add_action('wp_login', 'myEndSession'); function myStartSession() { if(!session_id()) { session_start(); } } function myEndSession() { session_destroy (); } </code></pre> </div>

请教大神,LABVIEW2018问题,装过NI 488.2运行还是提示未安装驱动,如图,用CAN工具发CAN信号

![图片说明](https://img-ask.csdn.net/upload/201909/11/1568164268_696405.png)![图片说明](https://img-ask.csdn.net/upload/201909/11/1568164275_908556.png)

关于python引用visa模块的问题

环境:WIN7 64位、python2.7 使用到visa借鉴了:https://blog.csdn.net/zx520113/article/details/87978080中的方法, 代码如下: ``` import visa rm = visa.ResourceManager() res = rm.list_resources() ``` 但是在运行到第二步: ``` rm = visa.ResourceManager() ``` 时就出现了异常: ``` AttributeError: 'module' object has no attribute 'ResourceManager' ``` 网上找了很久没有解决方案,希望有大佬来指点一二! python2/3都试过了,都是报错visam模块中没有ResourceManager()这个方法。

关于python3 导入模块失败,求解

![图片说明](https://img-ask.csdn.net/upload/201707/31/1501471144_45407.png) ![图片说明](https://img-ask.csdn.net/upload/201707/31/1501471162_785075.png) 为什么会导入失败

条纹支付网关不接受Visa / Master借记卡

<div class="post-text" itemprop="text"> <p>I have integrated Stripe payment simple checkout in PHP as mentioned in this <a href="https://stripe.com/docs/checkout#integration-simple" rel="nofollow noreferrer">Link</a>. I am able to process credit cards. However, when I am trying to process VISA/Master debit card it says <code>Card Declined</code>. The bank account used in Stripe is USA, and card from India. When I talked to stripe they say they are not declining it and I need to call local debit card holder's bank which I did and they said it should be processed. I even tried with an International shopping debit card.</p> <p>My code :</p> <pre><code> &lt;script src="https://checkout.stripe.com/checkout.js" class="stripe-button" data-key="pk_live_************************" data-amount="&lt;?php echo $stripeamount;?&gt;" data-name="KAEM Technologies USA, Inc" data-email="&lt;?php echo $email;?&gt;" data-currency="&lt;?php echo $curr; ?&gt;" data-description="Widget" data-image="https://stripe.com/img/documentation/checkout/marketplace.png" data-locale="auto"&gt; &lt;/script&gt; </code></pre> <p>Error code <code>402</code> on stripe :</p> <pre><code>{ "error": { "charge": "ch_*************************", "code": "card_declined", "decline_code": "do_not_honor", "doc_url": "https://stripe.com/docs/error-codes/card-declined", "message": "Your card was declined.", "type": "card_error" } } </code></pre> <p>So, if anyone has done debit card integration do let e know, I am stuck between the stripe and the bank.</p> <p>Thanks</p> </div>

程序运行出错,未使用调试信息生成二进制文件。

![![![![图片说明](https://img-ask.csdn.net/upload/201807/25/1532500681_336595.png)图片说明](https://img-ask.csdn.net/upload/201807/25/1532500712_693184.png)图片说明](https://img-ask.csdn.net/upload/201807/25/1532500696_517089.png)图片说明](https://img-ask.csdn.net/upload/201807/25/1532500686_197034.png) 就这些代码,如果不用头文件,只将代码放在一个cpp文件里,则可以正常运行

安卓开发中Visa MasterCard支付是怎么实现的?

![图片说明](https://img-ask.csdn.net/upload/201507/10/1436512505_39324.jpg) 类似这种效果

如何更改Stripe中的语言 - Woocommerce

<div class="post-text" itemprop="text"> <p>I'm setting up a webshop in Woocommerce and Stripes payment checkout is set to English.</p> <p>I have tried to read Stripes documentation, and it says that you have to insert a line of code <code>data-locale="auto"</code> to change the language, but I can't figure out what file I have to add the line of code to.</p> <p>Where do I add the <code>data-locale</code>?</p> </div>

实现MPI的PHP库 - 通过Visa和SecureCode验证?

<div class="post-text" itemprop="text"> <p>What are the solutions? Anything open source. If only commercial applications, what are they?</p> </div>

急求!在LabwindowsCVI环境下,如何基于VISA实现DMA通讯?

小弟在开发一个项目,要求在LabwindowsCVI环境下,实现对PCIE板卡的DMA数据通讯模式,基于VISA库,想问问有没有大佬有相关方面的参考资料或应用实例可以提供参考的,万分感谢!!

如何在html5 + css3签证申请表中添加图像预览

<div class="post-text" itemprop="text"> <p>I am developing a html5+css3 visa application form. <a href="https://codepen.io/ivailo-nenov/pen/eoxowL" rel="nofollow noreferrer">https://codepen.io/ivailo-nenov/pen/eoxowL</a> </p> <pre><code>&lt;!-- Right topheader --&gt; &lt;div class="topheader-right"&gt; &lt;div id="photo"&gt; &lt;div id="phototext"&gt;PHOTO&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>I do not know how to add image preview in the right corner - the user must click on "PHOTO" to be able to upload his passport photo. The dimensions of the photo should be exactly 35mm x45mm PLEASE HELP!</p> </div>

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

华为初面+综合面试(Java技术面)附上面试题

华为面试整体流程大致分为笔试,性格测试,面试,综合面试,回学校等结果。笔试来说,华为的难度较中等,选择题难度和网易腾讯差不多。最后的代码题,相比下来就简单很多,一共3道题目,前2题很容易就AC,题目已经记不太清楚,不过难度确实不大。最后一题最后提交的代码过了75%的样例,一直没有发现剩下的25%可能存在什么坑。 笔试部分太久远,我就不怎么回忆了。直接将面试。 面试 如果说腾讯的面试是挥金如土...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

win10暴力查看wifi密码

刚才邻居打了个电话说:喂小灰,你家wifi的密码是多少,我怎么连不上了。 我。。。 我也忘了哎,就找到了一个好办法,分享给大家: 第一种情况:已经连接上的wifi,怎么知道密码? 打开:控制面板\网络和 Internet\网络连接 然后右击wifi连接的无线网卡,选择状态 然后像下图一样: 第二种情况:前提是我不知道啊,但是我以前知道密码。 此时可以利用dos命令了 1、利用netsh wlan...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

带了6个月的徒弟当了面试官,而身为高级工程师的我天天修Bug......

即将毕业的应届毕业生一枚,现在只拿到了两家offer,但最近听到一些消息,其中一个offer,我这个组据说客户很少,很有可能整组被裁掉。 想问大家: 如果我刚入职这个组就被裁了怎么办呢? 大家都是什么时候知道自己要被裁了的? 面试软技能指导: BQ/Project/Resume 试听内容: 除了刷题,还有哪些技能是拿到offer不可或缺的要素 如何提升面试软实力:简历, 行为面试,沟通能...

!大部分程序员只会写3年代码

如果世界上都是这种不思进取的软件公司,那别说大部分程序员只会写 3 年代码,恐怕就没有程序员这种职业。

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

HTTP与HTTPS的区别

面试官问HTTP与HTTPS的区别,我这样回答让他竖起大拇指!

程序员毕业去大公司好还是小公司好?

虽然大公司并不是人人都能进,但我仍建议还未毕业的同学,尽力地通过校招向大公司挤,但凡挤进去,你这一生会容易很多。 大公司哪里好?没能进大公司怎么办?答案都在这里了,记得帮我点赞哦。 目录: 技术氛围 内部晋升与跳槽 啥也没学会,公司倒闭了? 不同的人脉圈,注定会有不同的结果 没能去大厂怎么办? 一、技术氛围 纵观整个程序员技术领域,哪个在行业有所名气的大牛,不是在大厂? 而且众所...

程序员为什么千万不要瞎努力?

本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

终于懂了TCP和UDP协议区别

终于懂了TCP和UDP协议区别

Python爬虫,高清美图我全都要(彼岸桌面壁纸)

爬取彼岸桌面网站较为简单,用到了requests、lxml、Beautiful Soup4

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

美团面试,问了ThreadLocal原理,这个回答让我通过了

他想都想不到,ThreadLocal我烂熟于心

大牛都会用的IDEA调试技巧!!!

导读 前天面试了一个985高校的实习生,问了他平时用什么开发工具,他想也没想的说IDEA,于是我抛砖引玉的问了一下IDEA的调试用过吧,你说说怎么设置断点...

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

立即提问
相关内容推荐