Jump to content

Need help "post"


kctvt
 Share

Recommended Posts

I'm testing programe Auto Post New Topic.... but, i got some problems ... I need help...

I cant Click the button Submit

And this's website's code which i'm testing on.

Code Form :

<form action="newthread.php?do=postthread&f=120" method="post" name="vbform" onsubmit="return vB_Editor['vB_Editor_001'].prepare_submit(this.subject.value,10)">

Code button Submit1 : (=Code button Submit2 + ID)

<input type="submit" class="button" name="sbutton" id="vB_Editor_001_save" value="Gởi Đề Tài Mới" accesskey="s" tabindex="1">

Code button Submit2 :

<input type="submit" class="button" name="sbutton" value="Gởi Đề Tài Mới" accesskey="s" tabindex="1">

Code testing:

#include <IE.au3>

$username = "test0014"

$password = "matmun123"

$tieude = "Just Testssssssst"

;Dzo8 max : 85 kí tự cho tiêu đề

$message = (''&@CR&'Liên hệ :'&@CR&'- 0973.22.88.72 (Phi – Y!H: Phamvietphi)'&@CR&'- Hoặc (08). 66. 599. 488 (Khoa luôn - Y!H: Lấy cái trên đi cho lẹ)'&@CR&@CR&'Test test test…. Test Post New Topic')

$tag5 = ("test")

$oIE = _IECreate ("http://dzo8.com/")

_IELoadWait ($oIE)

sleep(3000)

$o_form = _IEFormGetCollection ($oIE, 0)

$o_login = _IEFormElementGetCollection ($o_form, 0)

$o_password = _IEFormElementGetCollection ($o_form, 2)

_IEFormElementSetValue ($o_login, $username)

_IEFormElementSetValue ($o_password, $password)

Sleep(10)

_IEFormSubmit ($o_form)

_IELoadWait ($oIE)

;============================== Chuyển sang Post New Topic ===================================

Sleep(50)

_IENavigate ($oIE, "http://dzo8.com/8/newthread.php?do=newthread&f=120")

_IELoadWait ($oIE)

;$oform = _IEFormGetObjByName($oIE, "vbform")

;It dont work. So i added ";"

$oSubject = _IEGetObjByName ($oIE, "subject")

_IEFormElementSetValue ($oSubject,$tieude)

$oMess = _IEGetObjByName ($oIE, "message")

_IEFormElementSetValue ($oMess,$message)

$oTag = _IEGetObjByName ($oIE, "taglist")

_IEFormElementSetValue ($oTag,$tag5)

$oReport = _IEGetObjByName ($oIE, "emailupdate")

_IEFormElementOptionselect($oReport,1, 1, "byIndex")

$icon = _IEGetObjByName ($oIE, "rb_iconid_2")

_IEAction ($icon , "click")

$Button = _IEGetObjById ($oIE, "vB_Editor_001_save")

_IEAction ($Button, "Click")

Sleep(10000)

_IELoadWait ($oIE)

I dont know why my code not work ???

$Button = _IEGetObjById ($oIE, "vB_Editor_001_save")

_IEAction ($Button, "Click")

There are 2 button Submit in this page. That's the reason ? Help me this.... just Test, I'm not Spammer.

Edited by kctvt
Link to comment
Share on other sites

first, login with your IE manually to set a cookie:

Posted Image

then:

#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <ComboConstants.au3>
#include <GuiConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <IE.au3>
#Include <string.au3>
#include <array.au3>
_IEErrorHandlerRegister ()
_IELoadWaitTimeout (10000)
$maingui = GUICreate("ie test", 270, 250, -1, -1, $WS_BORDER)
GuiSetState(@sw_show, $maingui)
$oIE = _IECreateEmbedded ()
$GUIActiveX = GUICtrlCreateObj($oIE, 10, 120, 1, 1)
InetGet ( "http://dzo8.com/8/newthread.php?do=newthread&f=120", @TempDir & "\temp.htm", 1)
FileOpen ( @TempDir & "\temp.htm", 0 )
$chars = FileRead(@TempDir & "\temp.htm")
FileClose(@TempDir & "\temp.htm")
$chars = StringReplace ( $chars, "<form action=""newthread.php", "<form action=""http://dzo8.com/8/newthread.php")
$chars = StringReplace ( $chars, "---!>", "--->")
FileOpen ( @TempDir & "\temp.htm", 2 )
FileWrite(@TempDir & "\temp.htm", $chars)
FileClose(@TempDir & "\temp.htm")
_IENavigate ($oIE, @TempDir & "\temp.htm")
$oForm = _IEFormGetObjByName ($oIE, "vbform")
$oQuery = _IEFormElementGetObjByName ($oForm, "message")
$title = _IEFormElementGetObjByName ($oForm, "subject")
_IEFormElementSetValue ($title, "YOUR TITLE HERE")
_IEFormElementSetValue ($oQuery, "YOUR TEST MESSAGE HERE")
_IEFormSubmit ($oForm)

tested it here, works

Link to comment
Share on other sites

Oh.... Miracle....

It work.

I open http://dzo8.com/8/index.php, login to acc , and click option "Save this acc"

then, Run your code. ... It workded.

But, I still dont understand.

First:

_IELoadWaitTimeout (10000)

If i change 10000 into 1000, it'll not work.

Second:

#include <IE.au3>

$username = "test0014"

$password = "matmun123

; ======= Login ===================

$oIE = _IECreate ("http://dzo8.com/8/index.php")

_IELoadWait ($oIE)

sleep(3000)

$o_form = _IEFormGetCollection ($oIE, 0)

$o_login = _IEFormElementGetCollection ($o_form, 0)

$o_password = _IEFormElementGetCollection ($o_form, 2)

_IEFormElementSetValue ($o_login, $username)

_IEFormElementSetValue ($o_password, $password)

Sleep(10)

_IEFormSubmit ($o_form)

_IELoadWait ($oIE)

; ======= Open Post New Topic page ==========================

Sleep(50)

_IENavigate ($oIE, "http://dzo8.com/8/newthread.php?do=newthread&f=120")

_IELoadWait ($oIE)

;======= I call it is Red Code ===============

$oForm = _IEFormGetObjByName ($oIE, "vbform")

$oQuery = _IEFormElementGetObjByName ($oForm, "message")

$title = _IEFormElementGetObjByName ($oForm, "subject")

_IEFormElementSetValue ($title, "YOUR TITLE HERE")

_IEFormElementSetValue ($oQuery, "YOUR TEST MESSAGE HERE")

_IEFormSubmit ($oForm)

The Red Code dont work, I dont know why ?

Can you tell me something more about your code.

I plan write the code auto login, then auto post new topic. And still test, not spam.

Link to comment
Share on other sites

  • Moderators

Not to spam? I don't really believe you. PM me with a good reason to let you continue on with the subject.

Until then. Subject locked.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...