嘿,我正在运行我自己的PHP服务器(通过WAMP),并使用提供的Walgreens示例来测试上传的照片。
下面是我的一些代码,它似乎正在停止:
$affiliateId = "xxxxx";
$apiKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$apiEndPoint = "https://services-qa.walgreens.com/api/util/mweb5url";
$cred_data = array(
"serviceType"=>"wagS3",
"act"=>"genCredV2",
"view"=>"genCredV2JSON",
"affId"=> $affiliateId,
"apiKey"=>$apiKey,
"devinf"=>"IE,11",
"appver"=>"0.01"
);
$cred_data=json_encode($cred_data);
echo "<br/>Credential Request = ",$cred_data;
$headers = array('Content-type: application/json; charset=utf-8');
$curl = curl_init($apiEndPoint);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_POSTFIELDS, $cred_data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$cred_response = curl_exec($curl);
echo "<br/>Credential Response = ",$cred_response,"<br/>";
$cred_response = json_decode($cred_response,TRUE);
curl_close($curl);当我将它放置到与宿主公司一起托管的另一台服务器上并运行php文件时,它工作得很好(给回显"< br/>凭证响应= ",$cred_response,"< br/>";一个实际响应)。
但是,当我在本地机器上运行代码时,它不会作为响应返回任何内容,比如它被阻塞了吗?
我从另一台服务器得到的响应是:
Credential Request = {"serviceType":"wagS3","act":"genCredV2","view":"genCredV2JSON","affId":"xxxxx","apiKey":"xxxxxxxxxxxxxxxxxxxxxxxxxxxx","xxxxxx":"IE,11","appver":"0.01"}
Credential Response = {"uploadUrl":"http://xxxxxxxxxxxxx.com","secretKey":"xxxxxxxxxxxxxxxxxxxx","sessionId":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","err":"","accessKeyId":"xxxxxxxxxxxxxxxxxxxxxxxx"}我从本地服务器得到的响应是:
Credential Request = {"serviceType":"wagS3","act":"genCredV2","view":"genCredV2JSON","affId":"xxxxx","apiKey":"xxxxxxxxxxxxxxxxxxxxxxxxxxxx","xxxxxx":"IE,11","appver":"0.01"}
Credential Response = 我是否在Apache和/或PHP文件中缺少一个设置或插件?
发布于 2014-04-10 08:08:01
我遇到过这样的问题,问题是WALGreen服务器找不到localhost,甚至可能在它看到该域时甚至都不去看。
如果您设置了动态DNS服务,以便您的PC (更确切地说是路由器)可以找到一个实际的域名,即使域名名有点奇怪,它也会开始工作。
不要忘了将yuor路由器上的前80端口移植到运行WAMP的PC的ip上。在本地Apache上创建一个虚拟主机也是个好主意,这样域名,即动态dns名称和内部域名匹配。
发布于 2014-09-25 15:18:12
正确的答案是,您必须有一个affiliateID和每个键,这是由沃尔格林团队设置的。因此,这是无效的:
$affiliateId = "xxxxx";
$apiKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx";一定是这样的:
$affiliateId = "extest1";
$apiKey = "BLAHBLAHBLAHBLAH";根据开发人员门户上的文档,您必须注册一个帐户才能创建APIkey (https://developer.walgreens.com/user/register)。
https://stackoverflow.com/questions/22978084
复制相似问题