a.php
i.php
session_start();
$cookie_jar=tempnam("temp","webbeast");
$_SESSION[‘cookie_jar‘]=$cookie_jar;
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,"http://www.webbeast.cn/include/seccode.php");
curl_setopt($ch,CURLOPT_REFERER,"http://www.webbeast.cn/?action=show&id=26&page=1");
curl_setopt($ch,CURLOPT_COOKIEJAR,$cookie_jar);
curl_setopt($ch,CURLOPT_COOKIEFILE,$cookie_jar);
curl_setopt($ch,CURLOPT_USERAGENT,$_SERVER[‘HTTP_USER_AGENT‘]);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,false);
if(strpos(strtolower($_SERVER[‘HTTP_USER_AGENT‘]),‘msie‘)===false)
{
header("content-type:image/jpg");
}
curl_exec($ch);
curl_close($ch);
?>
b.php
session_start();
?>
i.php
session_start();
$cookie_jar=tempnam("temp","webbeast");
$_SESSION[‘cookie_jar‘]=$cookie_jar;
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,"http://www.webbeast.cn/include/seccode.php");
curl_setopt($ch,CURLOPT_REFERER,"http://www.webbeast.cn/?action=show&id=26&page=1");
curl_setopt($ch,CURLOPT_COOKIEJAR,$cookie_jar);
curl_setopt($ch,CURLOPT_COOKIEFILE,$cookie_jar);
curl_setopt($ch,CURLOPT_USERAGENT,$_SERVER[‘HTTP_USER_AGENT‘]);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,false);
if(strpos(strtolower($_SERVER[‘HTTP_USER_AGENT‘]),‘msie‘)===false)
{
header("content-type:image/jpg");
}
curl_exec($ch);
curl_close($ch);
?>
b.php
session_start();
?>
if(empty($_SESSION[‘cookie_jar‘])) exit();
$cookie_jar=$_SESSION[‘cookie_jar‘];
$verify=$_POST[‘verify_code‘];
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,"http://www.webbeast.cn/post.php");
curl_setopt($ch,CURLOPT_REFERER,‘http://www.webbeast.cn/?action=show&id=26&page=1‘);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,"articleid=26&formhash=2d47d0be&username=cat&password=&url=&content=oh,MyGOD!&clientcode=".$verify."&action=addcomment");
curl_setopt($ch,CURLOPT_COOKIEJAR,$cookie_jar);
curl_setopt($ch,CURLOPT_COOKIEFILE,$cookie_jar);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,false);
curl_exec($ch);
curl_close($ch);
?>
用上边这些代码示例可以调用到别人网站的验证码并且进行验证,如果作一下修改就能做到恰当地插入到自己的网站,