drny60365 2013-02-04 18:07
浏览 23
已采纳

Formstack api一直让我回到同一个json

Edited 05-02-2013. I have updated the curl code.

I have build a small class to work with formstack api. And I think that it works.

The problem is when I try to try all the leads from a form (more than 4000).

I build the urls with its page, time, and per_page param.

The strange is that Formstack give me back all the time the same json.

I have try that urls in a browser and it works great.

https://www.formstack.com/api/v2/form/xxxxxxxx/submission.json?oauth_token=xxxxthisismyoauthtokenxxxxx&per_page=100&min_time=2004-11-18 18:57:45&max_time=2013-02-04 18:57:45&page=0

https://www.formstack.com/api/v2/form/xxxxxxxx/submission.json?oauth_token=xxxxthisismyoauthtokenxxxxx&per_page=100&min_time=2004-11-18 18:57:45&max_time=2013-02-04 18:57:45&page=1

This is my curl code:

public function makeCurlGetCall($url)
{
  $curl = curl_init();
  curl_setopt($curl, CURLOPT_URL, $url);
  curl_setopt($curl, CURLOPT_HTTPGET, TRUE);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($curl, CURLOPT_HTTPHEADER,array('Content-type: application/json')); 
  curl_setopt($curl, CURLOPT_FRESH_CONNECT, 1);
  curl_setopt($curl, CURLOPT_COOKIEFILE, 'cookies.txt');
  curl_setopt($curl, CURLOPT_COOKIEJAR, 'cookies.txt');

  $result =  curl_exec($curl);
  curl_close($curl);

  return $result;
}

As I have say, If I run the Curl method in a for loop to build all the page url I get the same json, but If I chech the url in a browser it works great.

Thanks

Oskar

  • 写回答

1条回答 默认 最新

  • douhuanglou1445 2013-02-04 18:13
    关注

    Just Clear your cache and restart your browser. It will work , the browser is caching the response and you are getting the same response each time. Or the other thing may be you can have errors in the loop itself.

    for ($i = 1; $i <=  $lead_decode->pages; $i++)
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line