Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions C#/OpenApi.Utility/OpenApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
Expand All @@ -12,6 +14,20 @@ namespace OpenApi.Utility
{
public static class OpenApiClient
{

static OpenApiClient()
{
ServicePointManager.Expect100Continue = true;
ServicePointManager.ServerCertificateValidationCallback =
new RemoteCertificateValidationCallback(CheckValidationResult);
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
}

private static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true;
}

/// <summary>
/// 授权地址
/// </summary>
Expand Down
3 changes: 2 additions & 1 deletion PHP/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ $request = '{
"PageSize": 1500
}';
$result = send($url, $request,$accessToken);
```
```
如果使用过程中遇到调用https有问题可以参考这篇[文章](http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites/)
2 changes: 1 addition & 1 deletion PHP/core/global.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
//请替换自己的appid和appPrivateKey, 申请地址:http://open.ppdai.com/
//请替换自己的appid和appPrivateKey, 申请地址:https://open.ppdai.com/
$appid="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";

/**
Expand Down
8 changes: 6 additions & 2 deletions PHP/core/http.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,15 @@ function SendRequest ( $url, $request, $appId, $accessToken ){
curl_setopt ( $curl, CURLOPT_POST, 1 );
curl_setopt ( $curl, CURLOPT_POSTFIELDS, $request );
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ( $curl, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec ( $curl );
if($result===false)
{
echo 'Curl error: ' . curl_error($curl);
}
curl_close ( $curl );
// $j = json_decode ( $result, true );
var_dump($result);
var_dump("http response:".$result);
return $result;
}

Expand Down