hi, i have problem posting with a site using curl here is what i did: //---------------------posting curl $url="sample.com/addreply.aspx"; $msg="thanx :)"; //message to post $checksum="358768"; $curlPost = "msg=$msg&post=newreply&format=quick&quickmode=1&topic value=14471405&forum value=169&checksum value=$checksum&caller=$url"; $ch1 = curl_init(); curl_setopt($ch1, CURLOPT_URL, $url; curl_setopt($ch1, CURLOPT_HEADER, 1); curl_setopt($ch1, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)'); curl_setopt($ch1, CURLOPT_COOKIEJAR, 'cookie.txt'); curl_setopt($ch1, CURLOPT_COOKIEFILE, 'cookie.txt'); //saved cookies curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch1, CURLOPT_POST, 1); curl_setopt($ch1, CURLOPT_POSTFIELDS, $curlPost); $data = curl_exec($ch1); curl_close($ch1); PHP: here is the form of the site (java script code): function quickreplyform() { if (memberID > 0) { document.write("<tr>\ [COLOR="Red"]<form name=quickreply action=\""+link+"&t="+ topicID +"\" method=post>\[/COLOR] <td bgcolor=white valign=top align=center><br>\ <img src="+fileURL+"icon.aspx?m=reply_topic><br><br><font color=red>\n\ ÃÖà <br>Ñà ÓÑÃÚ\n"); document.write("</td><td bgcolor=white colspan=3 width=100% valign=top align=center>\ [COLOR="Red"]<textarea name=msg style=\"width:100%;height:150;"+memberFormat+"\"></textarea>\[/COLOR] [COLOR="Red"]<input type=button onclick='submitQuickReplyForm(1)' value=\"ÃÖà ÇáÑà ááãæÖæÚ\">"); [/COLOR] document.write([COLOR="Red"]"<input type=hidden name=post value=newreply>\ <input type=hidden name=format value=quick>\ <input type=hidden name=quickmode value=1>\ <input type=hidden name=topic value="+topicID+">\ <input type=hidden name=forum value="+forum_id+">\ <input type=hidden name=checksum value="+ucs+">\ <input type=hidden name=caller value=\""+escape(document.location)+"\">\[/COLOR] </td></form></tr>"); } } function submitQuickReplyForm(mode) { var x = quickreply.msg.value; while ((x.substring(0,1) == ' ') || (x.substring(0,1) == '\r') || (x.substring(0,1) == '\n') || (x.substring(0,1) == '\t')) x = x.substring(1); quickreply.msg.value = x; quickreply.quickmode.value = mode; if (quickreply.msg.value.length < 3) return; else { if (mode == 2) if (!confirm(msg_confirm_lock_topic)) return; quickreply.submit(); } } PHP: i've highlighted the posting fields...to make things more clear anyone? thanx in advance
this is just a guess because you didn't say what the error is, but can you post with curl to a javascript form? Looks like you have spaces in the post variable names?! is that valid?
well 1stly, the form is not submitting anything this is the error.. 2ndly I want to directly submit the values without passing the values into js function.. 3rdly, what shall i put inside the spaces??
2ndly part could be causing your 1stly problem. 3rdly part, get rid of the spaces. make topic value, topicvalue see what happens.
i have corrected the values here is the fixed version: $curlPost = "msg=$msg&post=newreply&format=quick&quickmode=1&topic=$grabed_topics&forum=169&checksum=$checksum&caller=$topic_url"; PHP: but still nothing.. its not posting
on the page you are posting to.. see if this value is set or has anything in it, $_POST['msg'] put that at the top of your php script.. if you see anything, then you know your curl routine is working.. Also, you can echo something from your script so that $data ends up holding a value. In fact, after you close your curl handle, do an echo on $data and see whats being returned.
just added: $curlPost = "msg=$msg&post=newreply&format=quick&quickmode=1&topic=$grabed_topics&forum=169&checksum=$checksum&caller=$topic_url&submit=Submit"; and i corrected the curl link...thats all