使用php和simPro API列出客户
我在此处登录到一个帐户: 在安装/应用程序中,我创建了一个新的应用程序。访问类型直接访问,签名方法HMAC-SHA1 在“应用程序URI”指向的文件中,我有以下内容:使用php和simPro API列出客户,php,api,Php,Api,我在此处登录到一个帐户: 在安装/应用程序中,我创建了一个新的应用程序。访问类型直接访问,签名方法HMAC-SHA1 在“应用程序URI”指向的文件中,我有以下内容: $headers = array( 'Host: sandbox.simpro.co', 'Authorization: OAuth,oauth_version="1.0", oauth_nonce="1d0c9d11a944b2439cf867f32d59d21b", oauth_timestam
$headers = array(
'Host: sandbox.simpro.co',
'Authorization: OAuth,oauth_version="1.0",
oauth_nonce="1d0c9d11a944b2439cf867f32d59d21b",
oauth_timestamp="1355952869",
oauth_consumer_key="sandbox-simpro-......",
oauth_signature_method="HMAC-SHA1Access",
oauth_signature="....."',
'Content-Type: application/json',
'Accept: application/json'
);
$url = 'https://sandbox.simpro.co/api/oauth/access_token.php';
$context = array(
'http' => array(
'content' => $content,
'header' => implode("\r\n", $headers) . "\r\n",
'method' => $method,
'timeout' => 10.0,
'ignore_errors'=>false
)
);
$response = file_get_contents(
$url, false,
stream_context_create($context));
if ($response === false){
var_dump("<hr><pre>Request Failed", array('url'=>$url, 'method'=>$method, 'headers'=>$headers, 'content'=>$content),'</pre>');
}
我知道我没有以正确的方式描述我的问题,这是因为我很难理解这个API。然后,请给我一个php脚本的链接,其中使用了以下部分:
请求令牌
授权书
访问令牌
我只想列出使用PHP和simPRO的客户 也许值得一看我们在GitHub上提供的示例代码: 这个PHP示例包括使用OAuth与SimproAPI的基本连接和一个简单的数据请求
如果您需要任何进一步的信息或帮助,请告诉我。“什么都不管用”不是一个好的问题描述。如果
$response
为false
(在这种情况下,var\u dump()
)会打印哪些错误消息),您永远不会在意。我们甚至不能自己尝试,因为这是一个缺少签名的一次性授权代码。您可以使用文件\u get\u contents()
加载任何其他内容(例如http://php.net
)?您启用了完整错误报告吗?我们可以在.net中使用simpro api吗?
Warning: file_get_contents(https://sandbox.simpro.co/api/oauth/access_token.php) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 501 Not Implemented in /.../index.php on line 64
string(23) "
Request Failed"
array(4) {
["url"]=>
string(52) "https://sandbox.simpro.co/api/oauth/access_token.php"
["method"]=>
string(4) "post"
["headers"]=>
array(4) {
[0]=>
string(23) "Host: sandbox.simpro.co"
[1]=>
string(318) "Authorization: OAuth,oauth_version="1.0",
oauth_nonce="1d0c9d11a944b2439cf867f32d59d21b",
oauth_timestamp="1355952869",
oauth_consumer_key="sandbox-simpro-.....",
oauth_signature_method="HMAC-SHA1Access",
oauth_signature="...........""
[2]=>
string(30) "Content-Type: application/json"
[3]=>
string(24) "Accept: application/json"
}
["content"]=>
string(0) ""
}
string(6) "