0
$current = $_GET['current'];
$future = $_GET['future'];
//$CMD = $_GET['CMD'];
$current = mktime(0,0,0,date("m"),date("d"),date("Y"));
$currentDate = date("Y-m-d",$current);
$future = mktime(0,0,0,date("m"),date("d")+7,date("Y"));
$futureDate = date("Y-m-d", $future);
//need to get the futureDate for URL
//$futrureDate = date("Y-m-d",$_GET['finalDate'])
// build feed URL
$googleURL = "http://www.google.com/calendar/feeds/$userid/private-$magicWord/basic?start-min=$currentDate&start-max=$futureDate/full?alt=json";
//$googleURL = "http://www.google.com/calendar/feeds/$userid/private-$magicWord/basic?alt=json";
//$url = "http://www.google.com/calendar/feeds/[email protected]/public/full?alt=json";
$data = file_get_contents($googleURL);
echo $data;
//$json = json_encode($data);
//echo $json;
//By default json_decode returns an stdClass object. You have to give a second parameter for this function TRUE.
$object = json_decode($json,TRUE);
print_r($object->title[1]);
//echo $object->title[0];
我在哪裏把日期變量中的alt = json放在url中。它可以正常工作,當我從URL中排除日期,但隨後對它們無效。也當我嘗試打印一個特定的對象時,我得到一個錯誤,該對象不存在。謝謝!從谷歌日曆返回json和用php解析
我想,第一,這是我所得到的未能打開流:HTTP請求失敗! HTTP/1.0 400錯誤請求 – user1366589