zzallexx
Хранитель порядка
- Регистрация
- 11 Июн 2008
- Сообщения
- 1.057
- Реакции
- 696
полный код файла, только что проверил работает
можешь с регуляркой еще попробовать
PHP:
<?
require_once("../admin/conf.php");
require_once("jshttprequest.php");
$JsHttpRequest=new JsHttpRequest("utf-8");
$host=parse_url(@$_SERVER['HTTP_REFERER']); if(@$host['host']!=@$_SERVER['HTTP_HOST'])die();
if(ctype_digit(@$_REQUEST['sum'])>0 && ($_REQUEST['type']=="usd" || $_REQUEST['type']=="eur" || $_REQUEST['type']=="uah")){
$url="http://www.google.com/search?q=".$_REQUEST['sum']."+rub+in+".$_REQUEST['type'];
$cinit=curl_init();
curl_setopt($cinit,CURLOPT_URL,$url);
curl_setopt($cinit,CURLOPT_HEADER,0);
curl_setopt($cinit,CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
curl_setopt($cinit,CURLOPT_FOLLOWLOCATION,1);
curl_setopt($cinit,CURLOPT_RETURNTRANSFER,1);
$text=curl_exec($cinit);
curl_close($cinit);
$pos_begin=strpos($text,'<img src="/images/icons/onebox/calculator-40.gif" width=40 height=40 alt="">');
$text=substr($text,$pos_begin);$pos_end=strpos($text,"Rates provided for information only");
$text=substr($text,0,$pos_end-1);$text=strip_tags($text);
$GLOBALS['_RESULT']="<span class=\"red b\">".$text."</span>";
}else $GLOBALS['_RESULT']=$lang[98];
?>
PHP:
<?
require_once("../admin/conf.php");
require_once("jshttprequest.php");
$JsHttpRequest=new JsHttpRequest("utf-8");
$host=parse_url(@$_SERVER['HTTP_REFERER']); if(@$host['host']!=@$_SERVER['HTTP_HOST'])die();
if(ctype_digit(@$_REQUEST['sum'])>0 && ($_REQUEST['type']=="usd" || $_REQUEST['type']=="eur" || $_REQUEST['type']=="uah")){
$url="http://www.google.com/search?q=".$_REQUEST['sum']."+rub+in+".$_REQUEST['type'];
$cinit=curl_init();
curl_setopt($cinit,CURLOPT_URL,$url);
curl_setopt($cinit,CURLOPT_HEADER,0);
curl_setopt($cinit,CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
curl_setopt($cinit,CURLOPT_FOLLOWLOCATION,1);
curl_setopt($cinit,CURLOPT_RETURNTRANSFER,1);
$text=curl_exec($cinit);
curl_close($cinit);
preg_match('/<h2 class=r style=\"font-size:138%\"><b>(.*?)<\/b><\/h2>/si',$text,$match);
$text=$match[1];$text=strip_tags($text);
$GLOBALS['_RESULT']="<span class=\"red b\">".$text."</span>";
}else $GLOBALS['_RESULT']=$lang[98];
?>