1
編輯05-02-2013。我已經更新了捲曲代碼。Formstack api始終讓我回到相同的json
我已經建立了一個小類,與formstack api一起工作。我認爲它有效。
問題是,當我嘗試嘗試從窗體(超過4000)的所有線索。
我使用它的頁面,時間和per_page參數構建了url。
奇怪的是,Formstack一直給我回來一樣的json。
我已經嘗試在瀏覽器中的網址,它的效果很好。
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
這是我的捲曲代碼:
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;
}
正如我說的,如果我在一個for循環建立的所有頁面的URL我得到同樣的JSON運行卷曲的方法,但如果我chech在瀏覽器中的網址,它工作的很好。
感謝
奧斯卡
你好,瀏覽器效果很好,問題在於Curls調用。 捲曲調用中是否存在緩存? –
試試CURLOPT_FRESH_CONNECT –
你好Bhushan,對不起,遲到了。 我試過「CURLOPT_FRESH_CONNECT」,而且我仍然有同樣的問題。 –