<?php教程
function vcurl($url, $post = , $cookie = , $cookiejar = , $referer = ){
$tmpInfo = ;
$cookiepath = getcwd()../.$cookiejar;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER[HTTP_USER_AGENT]);
if($referer) {
curl_setopt($curl, CURLOPT_REFERER, $referer);
} else {
curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
}
if($post) {
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
}
if($cookie) {
curl_setopt($curl, CURLOPT_COOKIE, $cookie);
}
if($cookiejar) {
curl_setopt($curl, CURLOPT_COOKIEJAR, $cookiepath);
curl_setopt($curl, CURLOPT_COOKIEFILE, $cookiepath);
}
//curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 100);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$tmpInfo = curl_exec($curl);
if (curl_errno($curl)) {
echo <pre><b>错误:</b><br />.curl_error($curl);
}
curl_close($curl);
return $tmpInfo;
}
?>
PHP截取指定图片大小实例代码
header("Content-type: image/jpeg");
$filename = book_rabbit_rule.jpg;
/* 读取图档 */
$im = imagecreatefromjpeg($filename);
/* 图片要截多少, 长/宽 */
$new_img_width = 120;
$new_img_height = 42;
/* 先建立一个 新的空白图档 */
$newim = imagecreate($new_img_width, $new_img_height);
// 输出图要从哪边开始 x, y ,原始图要从哪边开始 x, y ,要画多大 x, y(resize) , 要抓多大 x, y
imagecopyresampled($newim, $im, 0, 0, 7, 174, 120, 42, $new_img_width, $new_img_height);
/* 放大成 500 x 500 的图 */
// imagecopyresampled($newim, $im, 0, 0, 100, 30, 500, 500, $new_img_width, $new_img_height);
/* 将图印出来 */
imagejpeg($newim);
/* 资源回收 */
imagedestroy($newim);
imagedestroy($im);
?>
php 文件下载实例代码
php教程 文件下载实例代码
function xiazai($file_dir,$file_name)
//参数说明:
//file_dir:文件所在目录
//file_name:文件名
{
$file_dir = chop($file_dir);//去掉路径中多余的空格
//得出要下载的文件的路径
if($file_dir != )
{
$file_path = $file_dir;
if(substr($file_dir,strlen($file_dir)-1,strlen($file_dir)) != /)
$file_path .= /;
$file_path .= $file_name;
}
else
$file_path = $file_name;
//判断要下载的文件是否存在
if(!file_exists($file_path))
{
alert(对不起,你要下载的文件不存在);
return false;
}
站内搜索关键词变亮方法
我们这个做法是把搜索结果出来,与搜索关键词相同的替换成高亮的字, 我们会用到str_replace(你找的关键字,“<带有高亮的html标签>你找的关键字带有高亮的html标签>”,$str);
php fsockopen 伪造 post和get方法
本文章为你提供一款php教程 fsockopen 伪造 post和get方法哦,如果你正在找 伪造 post和get方法的php处理代码这款不错哦。
<?php
//fsocket模拟post提交
$purl = "http://localhost/netphp/test2.php?uu=rrrrrrrrrrrr";
print_r(parse_url(http://pic1.phprm.com/2013/09/05/http://pic1.phprm.com/2013/09/05/http://pic1.phprm.com/2013/09/05/$url.jpg.jpg.jpg));
sock_post($purl,"uu=55555555555555555");
php 超大文件下载程序[http 缓存协商,Etag标记,断点续传]
<?php教程
002 $file_path = ./download/download_cn.rar;
php 超大文件下载类 支持2g以上文件 支持断点续传
<?php教程
002 /**
php 将火车头采集db3数据导入到dedecms完整代码
php教程 将火车头采集db3数据导入到dedecms完整代码
$path ="d:pdoSpiderResult.db3";
$conn = new PDO("sqlite:$path");
$array=array(,,);
dedecms 软件批量增加描述连接方法
dedecms 软件批量增加描述连接方法
mysql教程_connect(localhost,root,root) or die(database connect failer);
mysql_select_db(m);
mysql_query("set Names gb2312");
电话号码 手机号码 正则表达式实例
电话号码 手机号码 正则表达式实例
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>电话号码 手机号码 正则表达式实例</title>
</head>
查百度—百度网站权重SEO工具查询
查百度—百度网站权重SEO工具查询
<html>
<title>查百度—百度网站权重SEO工具查询</title>
<meta http-equiv=Content-Language content=zh-cn>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name=keywords content="百度关键字,关键字排名,关键字查询">
<meta name="description" content="百度关键字查询系统的主要功能是:查询百度搜索引擎教程某个关键字的搜索结果中是否包含您的网页,并且能够查询出您的网页排在第几页.">
<meta name="robots" content="index, follow" />
<meta name="googlebot" content="index, follow" />
简单实例php 缓存文件生成技术实例
简单实例php教程 缓存文件生成技术实例
class Cache
{
protected $_cacheDir;
public function __construct()
{
$this->_cacheDir = "./cache";
}