使用PHP版的SDK,沒處理好,發現有個test/TestImage.php的測試文件,開始改,發現狀態碼$request -> getCode()一直爲0,一路調試上去,發現是getContents函數裏curl錯誤!輸出curl_errno($ch),SSL certificate problem: unable to get local issuer certificate 使用解決方法是證書問題。php
錯誤代碼 invalid-method 錯誤緣由: 不存在的方法名 一直未解決,多是$request應該是文檔中的AlipayCommerceCityfacilitatorVoucherGenerateRequest類實例仍是測試文件中的$alipayClient -> getContents() 返回值(AlipayMobilePublicMultiMediaExecute實例)還有Warning: openssl_sign(): supplied key param cannot be coerced into a private key in... 好多問題,又回頭看API發現頁面API下有示例代碼,喲吼吼吼。html
配置好以後有錯誤{"code":"40006","msg":"Insufficient Permissions","sub_code":"isv.insufficient-isv-permissions","sub_msg":"ISV權限不足"}
json
換了沙箱帳號,提醒另一個錯誤{"code":"40004","msg":"Business Failed","sub_code":"unknown-sub-code","sub_msg":"未知的錯誤碼"},但都是驗籤函數checkResponseSign()內出錯。api
object(SignData)[5] public 'signSourceData' => string '{"code":"40004","msg":"Business Failed","sub_code":"unknown-sub-code","sub_msg":"未知的錯誤碼"}' (length=101) public 'sign' => string 'EfXcLt1HDYQFHnfJRy31/S9+AeCd7J4jw/Zrphi2ImHgCIBGIbyZ8+Ch2yoiGeKN/tqdTPSEOosEI9QF1Nx53fHKHZG1SkrodwVzSSdkVPM9pxCszCn4u0ktTi925BazTFfNoq****JTHflEJ91GOhX19sbFYSnvD6RWus4YeFo=' (length=172)
追溯curl函數,url=https://openapi.alipaydev.com/gateway.do?app_id=2016091000478468&version=1.0&format=json&sign_type=RSA&method=alipay.commerce.cityfacilitator.station.query×tamp=2016-10-27+08%3A31%3A05&auth_token=&alipay_sdk=alipay-sdk-php-20160411&terminal_type=&terminal_info=&prod_code=¬ify_url=&charset=UTF-8&app_auth_token=&sign=T2xEACiz6ET%2FHs5DWdBZqrQQlB8nB8iw4%2F4VlEtqG6qVePjEop9IgLpgLt%2BOtDCJgbWYA%2FIlzyHXBRs9D1JYfT1wUHzYoXXATcXNm0rssfFLB********xdLHMn4DCF%2B4QQLLeZrBVV2nj7Kxo1Zz1zv5ElS%2FLialsFA%3Dapp
上面加劇的【×tamp=】很疑惑啊,×怎麼能夠在裏面,前面應該query就結束了而後應該是時間參數×tamp這個啊,改爲×tamp=就至少能夠返回了而不是這個錯誤:錯誤代碼 invalid-method 錯誤緣由: 不存在的方法名 了。看看哪裏構造url出錯的。curl
array (size=15) 'app_id' => string '2016091000478468' (length=16) 'version' => string '1.0' (length=3) 'format' => string 'json' (length=4) 'sign_type' => string 'RSA' (length=3) 'method' => string 'alipay.commerce.cityfacilitator.station.query' (length=45) 'timestamp' => string '2016-10-27 08:48:32' (length=19) 'auth_token' => null 'alipay_sdk' => string 'alipay-sdk-php-20160411' (length=23) 'terminal_type' => null 'terminal_info' => null 'prod_code' => null 'notify_url' => null 'charset' => string 'UTF-8' (length=5) 'app_auth_token' => null 'sign' => string 'f6ufUiSHCb7LNaXJvTdPEdDzfxKgepILJiKaM3wqueGojpOTZrVFRhVFqAQAxCEze9bVX77fpS/bvT8IVoD+/DMikZrje8SqkrSQvIHG8r1VhucgWplpgJU7HzViE*****************/MoG5OqfPf+H+rU+Eui7+bfYXtTDY=' (length=172)
能夠看出來確實應該是timestamp,×的html轉義字符就是×,因此 echo "×tamp=";會輸出×tamp這種幺蛾子。函數
foreach ($sysParams as $sysParamKey => $sysParamValue) {
$requestUrl .= "$sysParamKey=" . urlencode($this->characet($sysParamValue, $this->postCharset)) . "&";
}
&改成&好激動。post
然而,頁面什麼也沒有,錯誤也沒有,空白,空。繼續調測試
沒頭緒提了問題回答也沒頭緒。ui
10/28
昨天遇到的參數問題,我把timestamp提到了最前面,發現時間參數還差了6個小時,不說了直接time()+6*3600。而後[簽名無效]。又調了幾個小時,暫時擱置。