<?php
$test=post("http://127.0.0.1:81/lol/t.php",array("t=123"));
//$test=iconv("gb2312//IGNORE", "utf-8" , $test);
echo($test);function post($url, $data)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/xml', 'Content-Type: application/xml'));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$response = curl_exec($ch);
curl_close($ch); return $response;
}
?>提示这个:
Request Entity Too LargeThe requested resource
/lol/t.php
does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit.谢谢了.
$test=post("http://127.0.0.1:81/lol/t.php",array("t=123"));
//$test=iconv("gb2312//IGNORE", "utf-8" , $test);
echo($test);function post($url, $data)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/xml', 'Content-Type: application/xml'));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$response = curl_exec($ch);
curl_close($ch); return $response;
}
?>提示这个:
Request Entity Too LargeThe requested resource
/lol/t.php
does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit.谢谢了.
解决方案 »
- 关于PHP COM类及表单的一些问题
- 如何获取字段的最大值?SQL语句
- php+jquery+ajax分页的问题
- 请问DISCUZ论坛程序是不是开源的?
- PHP文件中的<script src='..'> </scirpt>中内容不能显示
- set_magic_quotes_runtime 对哪些数据或行为产生作用?当magic_quotes_gpc为on的话,print 表单变量,必须手动stripslashes吗?
- PHP编程时如何对SERV-U的用户密码进行加密?
- 怎样取得文件大小?
- 请给我解释下这个服务器描述语言是什么意思??
- php怎么抓取页面内容并存入mysql
- php判断字符串是否含有韩文,在线等
- 计算现在到某个时间差多少秒
$URL="http://xxx/Service.asmx/getFormatValuesV2?";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"$URL");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "u=demo&sc=SZX&ec=KHN&sd=2011-10-19&ed=2011-10-29&showround=&f=&t=");
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
$output = curl_exec($ch);
curl_close ($ch);实例,给分吧
$ch = curl_init();//初始化
curl_setopt($ch, CURLOPT_URL,"$URL");//模拟抓取的url
curl_setopt($ch, CURLOPT_POST, 1);//设定方式post
curl_setopt($ch, CURLOPT_POSTFIELDS, "u=demo&sc=SZX&ec=KHN&sd=2011-10-19&ed=2011-10-29&showround=&f=&t=");//post相关参数
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
$output = curl_exec($ch);//执行,结果储存到变量中
curl_close ($ch);//关闭
这句是怎么回事呀?
如果注释,,就直接输出来了,如果不注释掉,就报错了.500错误function post($url,$data)
{//模拟请求post数据
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"$url");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );//如果注释就不报错,但是立马输出了.
$output = curl_exec($ch);
curl_close ($ch);
//echo($output)//如果输出就报错
//return $output;
}