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.