Hello, i have a strong problem here...i must confess its beyond me. There is this Interbank transfer site i am connecting to via curl but i started getting an unusual error. At the first stage of the transaction, i visited the page with curl, stored the cookies to a file and then scanned the page to extract a unique value which should be used as one of the post values for the next stage. In the second stage however, I posted the data to the post page, but i never got a response in my return transfer showing that a post action had actually transpired. However, it returned the same page as though it was visited. I have tried all sorts of tricks to solve this but it never worked. but i believe there should be a solution here. The site is an interbank transfer site which i have an account with, so i want people to be posting the payment to my account with them via my site without needing to enter theirs.....................................
The code appears below
<?
///////////////I will Start my connections here with $curl and get the _VIEWSTATE
$txtPhone="08036239002";
$txtAmount="150";
$cboDest="Nigeria";
$btnSubmit="Ok";
$url="https://firstinlandonline.net/InterBankTransfer/Interbank.aspx";
$referer="https://firstinlandonline.net/";
$header[] = "Content-type: text/html";
$cookie="cookie/flashme1.txt";
$fp=fopen($cookie,w);
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, 'XtraDoh xAgent');
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_REFERER,$referer);
curl_setopt($ch, CURLOPT_TIMEOUT, 900);
curl_setopt($ch, CURLOPT_CONNECTIONTIMEOUT, 30);
curl_setopt($ch, CURLOPT_FAILONERROR, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch,CURLOPT_COOKIEFILE,$cookie);
curl_setopt($ch,CURLOPT_COOKIEJAR,$cookie);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
$content=curl_exec($ch);
////////LETS search for VIEWSTATE
$array=explode("\n",$content);
$count=count($array);
for($i=0;$i<$count;$i++){
if(stristr($array[$i],"VIEWSTATE")){
$array1=explode('value="',$array[$i]);
$content1=$array1[1];
$array2=explode('"',$content1);
$content2=$array2[0];
$_VIEWSTATE=$content2;
}
}
echo "$content2<BR>";
//////////////LETS GET OVER TO Stage 2
$VIEWSTATE=urlencode($VIEWSTATE);
$cboDest=urlencode($cboDest);
$btnSubmit=urlencode($btnSubmit);
$txtPhone=urlencode($txtPhone);
$txtAmount=urlencode($txtAmount);
$post = array("VIEWSTATE" => "$VIEWSTATE", "cboDest" => "$cboDest", "txtPhone" => "$txtPhone", "txtAmount" => "$txtAmount", "btnSubmit" => "$btnSubmit");
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$content_stage2=curl_exec($ch);
echo $content_stage2;
?>
Please i need an expert to help me out with this.