ScalixMailGoogleGadget
From Scalix Wiki
Copy/paste the code below in a text editor and save the file with .php extension (for example ScalixMailGoogleGadget.php) Modify the three fields ($user, $password, $url) at the beginning of this file
<?php /* * test_http.php * * @(#) $Header: /home/mlemos/cvsroot/http/test_http.php,v 1.14 2004/12/09 00:53:48 mlemos Exp $ * */ ?> <?php require("http.php"); require("sasl.php"); // Modify the three fields below... $user=""; // Scalix userid $password=""; // Scalix password $url=""; //http://<myscalix.org>/api/<mailbox@myscalix.com>/mailbox/INBOX/?output=rss // replace <myscalix.org> and <mailbox@myscalix.com> according to your settings set_time_limit(0); $http=new http_class; /* Connection timeout */ $http->timeout=0; /* Data transfer timeout */ $http->data_timeout=0; /* Output debugging information about the progress of the connection */ $http->debug=0; /* Format dubug output to display with HTML pages */ $http->html_debug=0; /* * Need to emulate a certain browser user agent? * Set the user agent this way: */ //$http->user_agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"; /* * If you want to the class to follow the URL of redirect responses * set this variable to 1. */ $http->follow_redirect=1; /* * How many consecutive redirected requests the class should follow. */ $http->redirection_limit=5; /* * If your DNS always resolves non-existing domains to a default IP * address to force the redirection to a given page, specify the * default IP address in this variable to make the class handle it * as when domain resolution fails. */ $http->exclude_address=""; /* * If basic authentication is required, specify the user name and * password in these variables. */ $base64=base64_encode($user.":".$password); /* * Generate a list of arguments for opening a connection and make an * HTTP request from a given URL. */ $error=$http->GetRequestArguments($url,$arguments); if(strlen($realm)) $arguments["AuthRealm"]=$realm; if(strlen($workstation)) $arguments["AuthWorkstation"]=$workstation; $http->authentication_mechanism=""; // force a given authentication mechanism; $arguments["Headers"]["Authorization"]="Basic ".$base64; $error=$http->Open($arguments); if($error=="") { $error=$http->SendRequest($arguments); if($error=="") { $headers=array(); $error=$http->ReadReplyHeaders($headers); if($error=="") { switch($http->response_status) { case "301": case "302": case "303": case "307": echo " (redirect to <TT>".$headers["location"]."</TT>)<BR>\nSet the <TT>follow_redirect</TT> variable to handle redirect responses automatically."; break; } for(;;) { $error=$http->ReadReplyBody($body,1000); if($error!="" || strlen($body)==0) break; echo $body; } flush(); } } $http->Close(); } if(strlen($error)) //echo "<CENTER><H2>Error: ",$error,"</H2><CENTER>\n"; ?>