Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function getPage($url, $referer, $timeout){
- if(!isset($timeout))
- $timeout=30;
- $curl = curl_init();
- if(strstr($referer,"://")){
- curl_setopt ($curl, CURLOPT_REFERER, $referer);
- }
- curl_setopt ($curl, CURLOPT_URL, $url);
- curl_setopt ($curl, CURLOPT_TIMEOUT, $timeout);
- curl_setopt ($curl, CURLOPT_USERAGENT, sprintf("Mozilla/%d.0",rand(4,5)));
- //curl_setopt ($curl, CURLOPT_HEADER, (int)$header);
- curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, 0);
- $html = curl_exec ($curl);
- curl_close ($curl);
- return $html;
- }
- $url = 'https://www.google.com/calendar/feeds/pomepure.calendar%40gmail.com/public/full?alt=json&orderby=starttime&max-results=15&singleevents=true&sortorder=ascending&futureevents=true';
- //$content=fopen($url, "r");
- $content=getPage($url, 'http://google.com', '30');
- $decode=json_decode($content);
- $feed=$decode->feed;
- for($i=0; $i<=10; $i++){
- echo "<div id=\"gcalblock\">\n";
- $t1='$t';
- $when='gd$when';
- $where='gd$where';
- $bila=$feed->entry[$i]->$when;
- echo "<div id=\"left\">\n";
- foreach($bila as $bila){
- $startday=date('d M Y',strtotime($bila->startTime));
- $endday=date('d M Y',strtotime($bila->endTime));
- $starttime=date('h:i a',strtotime($bila->startTime));
- $endtime=date('h:i a',strtotime($bila->endTime));
- $sbulan=date('F',strtotime($bila->startTime));
- $sday=date('d',strtotime($bila->startTime));
- $syear=date('Y',strtotime($bila->startTime));
- if($startday==$endday){
- echo $sbulan."<br>\n";
- echo "<h2>".$sday."</h2>\n";
- echo $syear."\n";
- }else{
- echo "From $startday at $starttime to $endday at $endtime<br>";
- }
- echo "</div>\n";
- echo "<div id=\"right\">\n";
- echo "<h3>".$feed->entry[$i]->title->$t1."</h3>\n";
- echo $starttime." - ".$endtime."<br>\n";
- $mana=$feed->entry[$i]->$where;
- foreach($mana as $mana){
- echo $mana->valueString."<br><br>\n";
- }
- echo $feed->entry[$i]->content->$t1."<br>\n";
- echo "</div>\n";
- }
- echo "</div>\n";
- echo "<br clear=\"all\">\n";
- }
- //echo "<pre>";
- //print_r($decode);
- //echo "</pre>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement