Oct292012
php 获取货币汇率api
// 货币汇率
function currency($from_Currency, $to_Currency, $amount) {
// currency ( "USD", "CNY", 1 );
$amount = urlencode ( $amount );
$from_Currency = urlencode ( $from_Currency );
$to_Currency = urlencode ( $to_Currency );
$url = "http://www.google.com/ig/calculator?hl=en&q={$amount}{$from_Currency}=?{$to_Currency}";
$ch = curl_init ();
...阅读全文
抢沙发
Oct272012
Oct222012
php获取某网站的快照时间
<html>
<head>
<title>在线演示_php获取某网站的快照时间 http://blog.qita.in</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="百度,baidu,查询快照结果">
<meta name="description" content="php查询网站快照日期: by enenba.com">
</head>
<body>
<?...阅读全文
Oct222012
php获取百度关键词查询结果总数
<html>
<head>
<title>在线演示_php获取百度关键词查询结果总数</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="百度,baidu,查询结果">
<meta name="description" content="php获取百度关键词查询结果总数 by enenba.com">
</head>
<body>
<?php $k=is...阅读全文
Oct222012
通过淘宝API接口查询客户端地址
<?php
/*
* 通过淘宝API接口查询客户端地址 调用淘宝的API接口http://ip.taobao.com/service/getIpInfo.php?ip=ip地址
*/
function get_ip_data() {
$ip = file_get_contents ( "http://ip.taobao.com/service/getIpInfo.php?ip=" . get_client_ip () );
$ip = json_decode ( $ip );
if ($ip->code) {
return false;
}
$data = ( array ) $ip->data;
return ...阅读全文
Oct222012
PHP加密解密函数
<?php
//加密
function passport_encrypt($txt, $key) {
srand ( ( double ) microtime () * 1000000 );
$encrypt_key = md5 ( rand ( 0, 32000 ) );
$ctr = 0;
$tmp = '';
for($i = 0; $i < strlen ( $txt ); $i ++) {
$ctr = $ctr == strlen ( $encrypt_key ) ? 0 : $ctr;
$tmp .= $encrypt_key [$ctr] . ($txt [$i] ^ $encrypt_key [$ctr ++]);
}
return ba...阅读全文
Oct222012
http请求处理类(基于CURL进行封装)
/**
* http请求处理类(基于CURL进行封装)
*
* @author 绝缘体
* @version $Id$
*/
class cls_http_request
{
/**
* get方式请求(curl)
*
* @param string $url 请求的url
* @param integer $timeout 超时时间(s)
* @return string(请求成功) | false(请求失败)
*/
public static function curl_...阅读全文
Aug122012
PHP中的魔术方法总结
PHP中的魔术方法总结 :__construct, __destruct , __call, __callStatic,__get, __set, __isset, __unset , __sleep, __wakeup, __toString, __set_state, __clone and __autoload
1、__get、__set
这两个方法是为在类和他们的父类中没有声明的属性而设计的
__get( $property ) 当调用一个未定义的属性时访问此方...阅读全文
Aug122012
snoopy(强大的PHP采集类) 详细介绍
Snoopy是一个php类,用来模拟浏览器的功能,可以获取网页内容,发送表单,可以用来开发一些采集程序和小偷程序,本文章详细介绍snoopy的使用教程。
Snoopy的一些特点:
抓取网页的内容 fetch
抓取网页的文本内容 (去除HTML标签) fetchtext
抓取网页的链接,表单 fetchlinks fetchform
支持代理主机
支持基本的用户名/密码验证
支...阅读全文
Aug082012
linux 防火墙操作
Linux代码
[root@localhost ~]# vi /etc/sysconfig/iptables
添加一行使其开放5433端口。
Linux代码
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5433 -j ACCEPT
然后重启服务使改动生效
[root@localhost ~]# service iptables restart
iptables: Flushing firewall rules: [ OK ]
iptables: Setting chains to policy ACCEPT: fi...阅读全文