PHP邮件留言本开源版

2010年7月16日 xfeng 49 条评论

下载后配置libs/cfg_mail.php文件即可,基于PHPMailer

本程序仅为不懂程序的新手提供帮助。老手请路过。

2010年8月12日更新

修正了Firefox浏览器和Opera下面提示”请输入内容”和乱码问题。请大家下载最新的源码进行测试。谢谢wkl17 同学的反馈.

PS:本站演示地址显示”正在发送”是因为我的邮箱SMTP发生问题。已经修复

2010年7月17日更新

发布之后,有同学反映邮件内容无法换行请将index.html大概92行的

1
var message= $("#message").val();

更换成

1
2
var message = document.getElementById("message").value;
message = message.replace(/\r\n/ig,"<br/>");

即可解决此问题。感谢chm同学!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
$cfg =  array(
	//smtp or mail  一般不需要改动
	'send_type'=>"smtp",
	//发送邮箱
	'from_email'=>"yourname@heqee.com",
	//接收邮箱。也可以用发送邮箱作为收件箱
	'to_email'=>"yourname@heqee.com",
	//邮件标题
	'from_title'=>"[HeQee]在线邮件留言",
	//邮件发送人名称
	'from_name'=>"HeQee Studio",	
	//邮件编码 一般不需要改动
	'charset'=>	"utf-8",
	//例smtp.gmail.com smtp.163.com
	'smtp_server'=>"smtp.163.com",
	//默认是25,如果SSL的就用465 smtp.gmail.com 就用465
	'smtp_port'=>"25",
	// 如果SSL的 0 or 1
	'smtp_ssl'=>0,
	//身份认证 一般不需要改动
	'smtp_auth'=>1,
	//发送邮箱账户
	'smtp_user'=>"yourname",
	//发送邮箱密码
	'smtp_pwd'=>"password",					
);
?>

演示:http://www.heqee.com/apps/guestbook/
下载开源代码地址:http://www.heqee.com/apps/download/MGuestbook.rar

PHP关闭浏览器后仍然继续执行的函数[PHP计划任务]

2010年7月15日 xfeng 1 条评论

备忘一下这个函数:
函数名称:ignore_user_abort
官方说明:http://cn2.php.net/manual/en/function.ignore-user-abort.php
使用方法:

1
ignore_user_abort(true); //即使Client断开(如关掉浏览器),PHP脚本也可以继续执行.

这样就可以实现计划任务效果了.但是还是要客户端访问程序才行.
比如说在生成静态页面、采集的时候,不需要在等待了。关掉浏览器吧。
例子:

1
2
3
4
5
6
7
8
//test
set_time_limit(0);
ignore_user_abort(true);
$i = 0 ;
while($i ++ < 200){
    file_put_contents($i.'.php' , $i);
    sleep(3);
}

完美解决failed to open stream: HTTP request failed!

2010年2月24日 xfeng 12 条评论

在工作中遇到这个问题,后完美解决,故分享给大家。
我批量抓取chemblink的结构式发现循环后有部分图片无法显示,而远程文件是存在的。
抓取远程文件的时候出现类似Warning: readfile(http://www.chemblink.com/structures/643-79-8.gif) [function.readfile]: failed to open stream: HTTP request failed! 这样的警告信息,我使用的是

4
5
6
7
ob_start(); 
readfile("http://www.chemblink.com/structures/643-79-8.gif");
$img = ob_get_contents(); 
ob_end_clean();

 
这样在运行中会时不时的出现上述错误,我也换过file_get_contents等其他函数都没用用,在网上查阅后发现用CURL方法抓取不会出错

6
7
8
9
10
11
$url = "http://www.chemblink.com/structures/643-79-8.gif";
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT,10);
$img = curl_exec($ch);

利用.htaccess将多个域名绑定到同一空间

2009年12月31日 xfeng 4 条评论

在工作中遇到将多个域名绑定到一个空间上,折腾一番然后用Apache的.htaccess解决了这个问题。其实原理就是判断访问的域名然后指向不同的目录。很简单,就直接贴内容了。不懂的同学请留言

阅读全文…

开博二个月,升到PR4

2009年12月31日 xfeng 7 条评论

blog-pr4

本博客建于2009-10-30,今天看了下PR和Alexa排名,很兴奋。PR4,Alexa 上综合排名第701025位。我仅发表了4篇文章。3篇是关于接口开源的。在此记录一下

Zend Guard 5.0 key 注册码

2009年12月2日 xfeng 7 条评论

 

image

guard-product-page-main

在网上淘了个Zend Guard 5.0的注册码.

我用Zend Guard – 5.0.1测试可用,在这里分享给大家

不过本人支持开源。适当的时候可以使用来保护怎么的版权

注册文件内容如下

Product-Name = Zend Guard
License-Version = 5.0
Registered-To = Ron Manney
Expires = 10-Jul-2010
Serial-No = 100570283
X-Issued-On = 10-Jul-2009
Hardware-Locked = No
Company-ID = Ron Manney

阅读全文...

IP归属地查询接口PHP版

2009年11月9日 xfeng 4 条评论

使用之前请去网上下载纯真IP数据库, “QQWry.dat” 放到当前目录下即可

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
/*
IpLocation API
使用之前请去网上下载纯真IP数据库, "QQWry.dat" 放到当前目录下即可
*/
include "libs/iplocation.class.php";
#需要查询的IP
$ip = "221.231.1.1";
//返回格式
$format = "text";//默认text,json,xml,js
//返回编码
$charset = "utf8"; //默认utf-8,gbk或gb2312
#实例化(必须)
$ip_l=new ipLocation();
$address=$ip_l->getaddress($ip);
 
$address["area1"] = iconv('GB2312','utf-8',$address["area1"]);
$address["area2"] = iconv('GB2312','utf-8',$address["area2"]);
 
$add=$address["area1"]." ".$address["area2"];
 
echo $add;
?>

演示:http://www.heqee.com/apps/ip/
下载开源代码地址:http://www.heqee.com/apps/download/IpLocationApi.rar

飞信好友免费短信API接口PHP开源版

2009年11月9日 xfeng 44 条评论

1,支持群发 (如果需要群发多号用英文逗号(,)分隔(159..,159..))
2,支持POST或GET方式提交数据
本站接口:
http://api.heqee.com/fetion/?username=飞信手机号码&passowrd=飞信手机密码&to=接收人号码&message=短信内容
或者
http://api.heqee.com/fetion/?u=飞信手机号码&p=飞信手机密码&t=接收人号码&m=短信内容
 
您也可以下载源码放在自己的网站上

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
/*
所需PHP扩展:curl, simplexml
*/
include "libs/fetion.class.php";
#设置飞信帐号密码
$username="15900000000";
$password="password";
//接收号码,多号码用","分隔(159..,159..)
$sendto ="15900000000,13400000000";
//消息内容
$message = "I am from heqee.com";
//实例化(必须)
$fetion = new fetion($username,$password);
//发送 返回布尔
$sms = $fetion->send($sendto,$message);
if($sms){
    echo "ok";
}
?>

演示:http://www.heqee.com/apps/fetion/
开源代码下载:http://www.heqee.com/apps/download/FetionApi.rar

Google Voice 短信发送接口PHP开源版

2009年11月9日 xfeng 64 条评论

1,支持群发
2,中文转成拼音发送
如果需要群发多帐号用英文逗号(,)分隔(86159..,86159..),消息内容不支持中文,当您输入中文的时候系统会自动转换为拼音(为了区分是拼音,拼音首字母大写),保证消息能正常发送(输入”我是旋风”短信内容为”Wo Shi Xuan Feng”).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
/*
提示:如果需要群发多帐号用英文逗号(,)分隔(86159..,86159..),消息内容不支持中文,
当您输入中文的时候系统会自动转换为拼音(为了区分是拼音,拼音首字母大写),
保证消息能正常发送(输入"我是旋风"短信内容为"Wo Shi Xuan Feng")
所需PHP扩展:curl  。字符编码均为GBK(考虑拼音转换)
*/
//引入拼音转换需要文件
include("libs/pinyin.php");
include "libs/googlevoice.class.php";
#设置google voice 帐号密码
$username="username@gmail.com";
$password="password";
//接受号码,多号码用","分隔(86159..,86159..)
$sendto ="8615900000000,8613400000000";
//消息内容
$message = "I am from heqee.com";
/*
转换中文为拼音程序自动识别中文进行替换,
此功能个人认为纯属娱乐,可以根据实际情况决定是否添加.
*/
//$message = zh2pinyin($message);
//实例化(必须)
$sms = new GoogleVoice($username,$password);
//返回结果
//Text sent to 86134...
echo $sms ->send($sendto,$message);
?>

演示:http://www.heqee.com/apps/gv/
开源代码下载:http://www.heqee.com/apps/download/GoogleVoiceApi.rar