doz97171 2014-04-10 03:24
浏览 45

使用WAMP(windows)的PHP Walgreens API卷曲问题?

Hey all i am running my own PHP server (via WAMP) and using the provided Walgreens API PHP example to test out uploads for photos.

Below is some of my code where it seems to be stopping:

$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);

When I place this onto my other server being hosted with a hosting company and run the php file it works just fine (giving the echo "< br/>Credential Response = ",$cred_response,"< br/>"; an actual response.).

However, when I run the code on my local machine it doesn't give anything back as a response like its being blocked or something?

The response back I get from the other server is:

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"}

The response back I get from my local server is:

Credential Request = {"serviceType":"wagS3","act":"genCredV2","view":"genCredV2JSON","affId":"xxxxx","apiKey":"xxxxxxxxxxxxxxxxxxxxxxxxxxxx","xxxxxx":"IE,11","appver":"0.01"}
Credential Response = 

Am i missing a setting or a plugin in either my Apache and/or PHP files?

  • 写回答

2条回答 默认 最新

  • dsj2014 2014-04-10 08:08
    关注

    I have had problems like this, the issue is that the WALGreen server cannot find localhost and probably wont even bother looking when it see that domain.

    If you set up a dymanic DNS service so that your PC (well the router rather) can be found with an actual domain name, even if the domain name is a little oddly named, it will start to work.

    Dont forget to port forward port 80 on yuor router to the ip of the PC running WAMP. Its also a good idea to create a Virtual Host on your local Apache so the domain names i.e. the dynamic dns name and the internal domain name match.

    评论

报告相同问题?

悬赏问题

  • ¥15 ogg dd trandata 报错
  • ¥15 高缺失率数据如何选择填充方式
  • ¥50 potsgresql15备份问题
  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错