cvs: phpweb / ws.php
| From: | Rasmus Lerdorf | Date: | Tue, 28 Feb 2006 00:50:12 +0000 |
| Subject: | cvs: phpweb / ws.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-30709@lists.php.net to get a copy of this message | ||
rasmus Tue Feb 28 00:50:12 2006 UTC
Added files:
/phpweb ws.php
Log:
Commit web services gateway code
http://cvs.php.net/viewcvs.cgi/phpweb/ws.php?view=markup&rev=1.1
Index: phpweb/ws.php
+++ phpweb/ws.php
<?php
if(!$conf=apc_fetch('ws_config')) {
include '/local/Web/ws.conf';
apc_store('ws_config',$conf);
}
$q = urlencode($_REQUEST['q']);
$r = isset($_REQUEST['results']) ? (int)$_REQUEST['results'] : 10;
$s = isset($_REQUEST['start']) ? (int)$_REQUEST['start'] : 1;
$l = isset($_REQUEST['lang']) ? htmlspecialchars($_REQUEST['lang']) :
'en';
$p = isset($_REQUEST['profile']) ? htmlspecialchars($_REQUEST['profile']) :
'all';
$sites = array( 'all'=>'site=php.net',
'local'=>'site=www.php.net',
'news'=>'site=news.php.net');
$request =
"{$conf['svc']}?appid={$conf['appid']}&query=$q&start=$s&results=$r&{$sites[$p]}&language=$l&output=php";
$data = @file_get_contents($request);
list($version,$status_code,$msg) = explode(' ',$http_response_header[0], 3);
if($status_code==200) echo $data;
else echo serialize($http_response_header[0]);
?>