In my last post you've said
"Problems with the code, issues with elements of it that you want to go over... language discussion, understanding more of the concepts behind it? This is the place."
So, now I have a problem with code. I want to send a message on tagworld with curl, but there's a problem. Here's my code (I can login and everything else):
//Message form
$msg['__EVENTTARGET'] = 'ctl00$ctl00$phBodyRight$phBodyRight$btnSend';
$msg['__EVENTARGUMENT'] = '';
$msg['__VIEWSTATE'] = $viewstate;
$msg['chooseuserradio'] = '1';
$msg['ctl00$ctl00$phBodyRight$phBodyRight$lcSendTo'] = $to;
$msg['ctl00$ctl00$phBodyRight$phBodyRight$tb_bmSubject'] = $subject;
$msg['ctl00$ctl00$phBodyRight$phBodyRight$RTE1'] = $message;
if(!empty($captcha)) {
$msg['ctl00$ctl00$phBodyRight$phBodyRight$tbUserCode'] = $captcha;
}
//Send message
curl_setopt($ch, CURLOPT_URL, "http://www.tagworld.com/$uname/SendMessage.aspx?recipient=$to");
curl_setopt($ch, CURLOPT_REFERER, "http://www.tagworld.com/$uname/SendMessage.aspx?recipient=$to");
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/1.6");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $msg);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$page = curl_exec($ch);
When I send the form above, it only sends a part of the form.
I have tried with posting to file on my server and do the print_r of $_POST, but here's what I got then:
POST:
Array
(
[Content-Type:_multipart/form-data;_boundary] => ----------------------------69a8b1ab6d4d
------------------------------69a8b1ab6d4d
Content-Disposition: form-data; name=\"__EVENTTARGET\"
ctl00$ctl00$phBodyRight$phBodyRight$btnSend
------------------------------69a8b1ab6d4d
Content-Disposition: form-data; name=\"__EVENTARGUMENT\"
------------------------------69a8b1ab6d4d
Content-Disposition: form-data; name=\"__VIEWSTATE\"
/wEPDwUKMTY1NDA1MTM0MA8WCB4LUmVmZXJyZXJVcmwFImh0dHA6Ly93d3cudGFnd29ybGQuY29tL2d1em9saXphYy8eB2NhcHRjaGFlHgdzdHJDb2RlZR4IaWRPZkNvZGVmFgJmD2QWAmYPZBYCAgMPZBYKAgEPZBYEZg9kFgRmD2QWAgIBDxYEHgRocmVmBStodHRwOi8vd3d3LnRhZ3dvcmxkLmNvbS9qb25rdXNhbi9JbmJveC5hc3B4Hglpbm5lcmh0bWwFAygyKWQCAQ8WBB8EBThodHRwOi8vd3d3LnRhZ3dvcmxkLmNvbS8tL1dvcmxkL1RyYWNraW5nLmFzcHg/YWZmX2lkPTkwNR4HVmlzaWJsZWhkAgIPDxYCHwZoZBYCAgEPFgQfBAUraHR0cDovL3d3dy50YWd3b3JsZC5jb20vam9ua3VzYW4vSW5ib3guYXNweB8FBQMoMilkAgIPZBYCAgIPZBYCZg8WAh4LXyFJdGVtQ291bnQCCWQCAw9kFgICAg9kFgJmDxYCHwcCAhYEAgEPZBYCZg9kFgJmDxYCHwcCBmQCAg9kFgJmD2QWAmYPFgIfB2ZkAggPZBYCZg9kFgQCBw8QZBAVARBTZWxlY3QgYSBsaXN0Li4uFQEBMBQrAwFnZGQCCw8PFgIfBmhkZAIKD2QWAgIGD2QWAmYPFgIfBmhkGAEFHl9fQ29udHJvbHNSZXF1aXJlUG9zdEJhY2tLZXlfXxYCBS5jdGwwMCRjdGwwMCRjdGwwMSRtZW51SGVhZGVyJGxvZ2luU3RhdHVzJGN0bDAxBS5jdGwwMCRjdGwwMCRjdGwwMSRtZW51SGVhZGVyJGxvZ2luU3RhdHVzJGN0bDAzXMKRiT4tr/RFCDc/1sdiyASCEeo=
------------------------------69a8b1ab6d4d
Content-Disposition: form-data; name=\"chooseuserradio\"
1
------------------------------69a8b1ab6d4d
Content-Disposition: form-data; name=\"ctl00$ctl00$phBodyRight$phBodyRight$lcSendTo\"
sendToUsername
------------------------------69a8b1ab6d4d
Content-Disposition: form-data; name=\"ctl00$ctl00$phBodyRight$phBodyRight$tb_bmSubject\"
PHP subject
------------------------------69a8b1ab6d4d
Content-Disposition: form-data; name=\"ctl00$ctl00$phBod
)
Like you see, it only sends a part of the form and when it gets to the message part, it stops. Does anyone know where's the problem?