dtqysxw4659 2016-04-02 18:15
浏览 608

PHP curl post总是返回500内部服务器错误

I'm trying to make a php curl to make a post in this link: http://g3cs.uesc.com/dsse1.asp, doing it in browser it works fine, ie: put some code like: 41225295 at input field and click at button it will make a post to http://g3cs.uesc.com/dsse2.asp, my code is:

<?php
function __curl($url,$p=NULL,$h=NULL,$ssl=0,$c=NULL,$tm=690,$header=0)
{
    $ch = curl_init();
    $opts = array(
    CURLOPT_URL => $url,
    CURLOPT_HEADER => $header,
    CURLOPT_FOLLOWLOCATION => 1,
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_SSL_VERIFYPEER => $ssl,
    CURLOPT_USERAGENT => 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)',
    CURLOPT_TIMEOUT => $tm,
    CURLOPT_REFERER => 'http://g3cs.uesc.com/dsse1.asp'
    );

    if($p)
    {
        $opts[CURLOPT_CUSTOMREQUEST] = 'POST';
        $opts[CURLOPT_POST] = 1;
        $opts[CURLOPT_POSTFIELDS] = http_build_query($p);
    }
    if($h) $opts[CURLOPT_HTTPHEADER] = $h;
    if($c) $opts[CURLOPT_COOKIE] = $c;

    curl_setopt_array($ch,$opts);
    $out = curl_exec($ch);

    if(!$out)
    {
        echo curl_error($ch);
        exit(0);
    }

    curl_close($ch);

    return $out;
}

echo __curl('http://g3cs.uesc.com/dsse2.asp',array('opt'=>'0','inacn'=>'127','inref'=>'41225295'));
?>

it always return 500 Internal Server Error.

someone could help me with some hints?

Thanks.

  • 写回答

1条回答 默认 最新

  • douxie7339 2016-04-02 18:37
    关注

    Can you make sure the server-side script (dsse2.asp) has no issues. I strongly believe Status 500 is something related to server-side script. it has nothing to do with your client

    评论

报告相同问题?

悬赏问题

  • ¥15 processing提取音乐节奏
  • ¥15 python进程启动打包问题
  • ¥15 gg加速器加速游戏时,提示不是x86架构
  • ¥15 python按要求编写程序
  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入
  • ¥20 XP系统在重新启动后进不去桌面,一直黑屏。
  • ¥15 opencv图像处理,需要四个处理结果图
  • ¥15 无线移动边缘计算系统中的系统模型
  • ¥15 深度学习中的画图问题
  • ¥15 java报错:使用mybatis plus查询一个只返回一条数据的sql,却报错返回了1000多条