Hi
I am using the following curl code to post into a ASPX url. When I do the execute, curl is posting and getting the result more than once. I am not sure why. Can anyone help me on this.
[php]
<?php
$ch = curl_init();
$POSTFIELDS = "UserName=test& Password=testpa pi&Name=geek";
$LOGINURL= "http://localhost/fun.aspx";
curl_setopt($ch , CURLOPT_USERAGE NT, $useragent);
curl_setopt($ch , CURLOPT_CONNECT TIMEOUT, 0);
curl_setopt($ch , CURLOPT_TIMEOUT , 0);
curl_setopt($ch ,CURLOPT_URL,$L OGINURL);
curl_setopt($ch ,CURLOPT_POST,1 );
curl_setopt($ch ,CURLOPT_POSTFI ELDS,$POSTFIELD S);
curl_setopt($ch , CURLOPT_RETURNT RANSFER, 1);
@extract($_REQU EST)
if($result = curl_exec($ch))
{
echo "<pre>".$result ."</pre>";
curl_close($ch) ;
unset($ch);
exit;
}
echo $result;
?>[/php]
Please read the Posting Guidelines before you post in this forum!.
Especially the part about enclosing code within php or code tags.
moderator
I am using the following curl code to post into a ASPX url. When I do the execute, curl is posting and getting the result more than once. I am not sure why. Can anyone help me on this.
[php]
<?php
$ch = curl_init();
$POSTFIELDS = "UserName=test& Password=testpa pi&Name=geek";
$LOGINURL= "http://localhost/fun.aspx";
curl_setopt($ch , CURLOPT_USERAGE NT, $useragent);
curl_setopt($ch , CURLOPT_CONNECT TIMEOUT, 0);
curl_setopt($ch , CURLOPT_TIMEOUT , 0);
curl_setopt($ch ,CURLOPT_URL,$L OGINURL);
curl_setopt($ch ,CURLOPT_POST,1 );
curl_setopt($ch ,CURLOPT_POSTFI ELDS,$POSTFIELD S);
curl_setopt($ch , CURLOPT_RETURNT RANSFER, 1);
@extract($_REQU EST)
if($result = curl_exec($ch))
{
echo "<pre>".$result ."</pre>";
curl_close($ch) ;
unset($ch);
exit;
}
echo $result;
?>[/php]
Please read the Posting Guidelines before you post in this forum!.
Especially the part about enclosing code within php or code tags.
moderator
Comment