Discuz!大师网

搜索
查看: 5016|回复: 8

模拟post提交表单的问题

[复制链接]
发表于 2014-3-22 11:19:00 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

x
有些表单提交不上去怎么办,求解,谢谢大家
回复 马甲回复

使用道具 举报

 楼主| 发表于 2014-3-22 11:19:00 | 显示全部楼层
<html>
<body>
<head>
<meta http-equiv="content-language" content="zh-cn"/>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<title>QQ空间留言</title>
</head>
<?php
$friend=$_POST["friend"];
$sid=$_POST["sid"];
$content=$_POST["content"];
$loop=$_POST["loop"];
function mypost($myurl)
{
$post_data = array();
//需要提交的post数据
$post_data['msg'] ="$content";
$post_data['B_UID']="$friend";
$post_data['ispostmsg'] = "1";
$post_data['submitbtn']="发表";
//目标地址
$url=$myurl;
foreach ($post_data as $k=>$v)
{
$o.= "$k=".urlencode($v)."&";
}
$post_data=substr($o,0,-1);
//开始通讯
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_URL,$url);
//为了支持cookie
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
//返回结果
$result = curl_exec($ch);
}
$i=0;
while($i<$loop)
{
mypost("http://blog60.z.qq.com/mmsgb/add_msg_action_switch.jsp?sid=$sid");
$i++;
}
 楼主| 发表于 2014-3-22 11:22:00 | 显示全部楼层
echo "$result$friend";
?>
</body>
</html>
 楼主| 发表于 2014-3-22 16:53:00 | 显示全部楼层
顶!!
 楼主| 发表于 2014-3-22 18:52:00 | 显示全部楼层
帮忙一下
发表于 2014-3-22 19:17:00 | 显示全部楼层
你要留言。
发表于 2014-3-22 19:19:00 | 显示全部楼层
稍等,我上代码。
发表于 2014-3-22 19:24:00 | 显示全部楼层
额,没懂
发表于 2014-3-22 20:57:00 | 显示全部楼层
稍等。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|网站地图|小黑屋|展会网|Discuz站长论坛 |天天打卡

GMT+8, 2024-4-24 08:12 , Processed in 0.026712 second(s), 8 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表