Realbasic如何在代码中提交HTML表单

时间:2013-12-19 19:21:29

标签: forms realbasic xojo

我正在努力学习如何使用代码点击HTML表单上的“提交”按钮。我似乎能够使用HTTPSocket设置变量 - 名称,电子邮件等 - 但是当套接字“帖子”时它不会触发提交。

将非常感激地收到任何帮助

干杯,

Alan McTavish ......

RB 2008 r1 ...请不要插件。

你好,

我使用的代码是软件给出的示例 - HTTP Example.rbp。它读取网站代码并要求我给出HTML中输入字段的值。但是,表格似乎没有提交。

服务器上的HTML如下:

<!DOCTYPE html><!-- HTML5 -->
<html lang="en" dir="ltr">
    <head>
        <title>ActivationNoted - Infosoft</title>
        <meta charset="utf-8" />
        <!--[if IE]><meta http-equiv="ImageToolbar" content="False" /><![endif]-->
        <meta name="author" content="Ian Shere" />
        <meta name="generator" content="Incomedia WebSite X5 Professional 10.1.0.39 - www.websitex5.com" />
        <meta name="viewport" content="width=774" />
        <link rel="icon" href="favicon.png" type="image/png" />
        <link rel="stylesheet" type="text/css" href="style/reset.css" media="screen,print" />
        <link rel="stylesheet" type="text/css" href="style/print.css" media="print" />
        <link rel="stylesheet" type="text/css" href="style/style.css" media="screen,print" />
        <link rel="stylesheet" type="text/css" href="style/template.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="style/menu.css" media="screen" />
        <!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="style/ie.css" media="screen" /><![endif]-->
        <link rel="stylesheet" type="text/css" href="pcss/activationnoted.css" media="screen" />
        <script type="text/javascript" src="res/jquery.js?39"></script>
        <script type="text/javascript" src="res/x5engine.js?39"></script>

    </head>
    <body>
        <div id="imHeaderBg"></div>
        <div id="imFooterBg"></div>
        <div id="imPage">
            <div id="imHeader">
                <h1 class="imHidden">ActivationNoted - Infosoft</h1>

            </div>
            <a class="imHidden" href="#imGoToCont" title="Skip the main menu">Go to content</a>
            <a id="imGoToMenu"></a><p class="imHidden">Main menu:</p>
            <div id="imMnMn" class="auto">
                <ul class="auto">
                    <li id="imMnMnNode0">
                        <a href="index.html">
                            <span class="imMnMnFirstBg">
                                <span class="imMnMnTxt"><span class="imMnMnImg"></span>Home Page</span>
                            </span>
                        </a>
                    </li><li id="imMnMnNode11">
                        <a href="features-of-footware.html">
                            <span class="imMnMnFirstBg">
                                <span class="imMnMnTxt"><span class="imMnMnImg"></span>Features of footware</span>
                            </span>
                        </a>
                    </li><li id="imMnMnNode12">
                        <a href="download.html">
                            <span class="imMnMnFirstBg">
                                <span class="imMnMnTxt"><span class="imMnMnImg"></span>Download</span>
                            </span>
                        </a>
                    </li><li id="imMnMnNode14">
                        <a href="support.html">
                            <span class="imMnMnFirstBg">
                                <span class="imMnMnTxt"><span class="imMnMnImg"></span>Support</span>
                            </span>
                        </a>
                    </li><li id="imMnMnNode3">
                        <a href="contact-us.html">
                            <span class="imMnMnFirstBg">
                                <span class="imMnMnTxt"><span class="imMnMnImg"></span>Contact Us</span>
                            </span>
                        </a>
                    </li>
                </ul>
            </div>
            <div id="imContentGraphics"></div>
            <div id="imContent">
                <a id="imGoToCont"></a>
                <h2 id="imPgTitle">ActivationNoted</h2>
                <div style="width: 754px; float: left;">
                    <div style="float: left; width: 377px;">
                        <div id="imCell_1" class="imGrid[0, 0]"><div id="imCellStyleGraphics_1"></div><div id="imCellStyle_1"><form id="imObjectForm_1" action="imemail/imEmailForm_160xo79k.php" method="post" enctype="multipart/form-data" style="width: 365px; margin: 0; padding: 0; text-align: left;">
                            <fieldset class="first">
                                <div>
                                    <div style="float: left; margin: 0; padding: 0 0 2px;"><label for="imObjectForm_1_1" style="vertical-align: top; display: inline-block; margin: 3px 0 2px 0; width: 351px;">Name</label><br /><input type="text" class="" style="float: left; width: 347px; margin-right: 10px; vertical-align: top; padding-top: 2px; padding-bottom: 2px;" id="imObjectForm_1_1" name="imObjectForm_1_1" /></div>
                        <div class="imClear" style="height: 1px; line-height: 1px; width: 365px;"></div>
                                    <div style="float: left; margin: 0; padding: 0 0 2px;"><label for="imObjectForm_1_2" style="vertical-align: top; display: inline-block; margin: 3px 0 2px 0; width: 351px;">E-mail</label><br /><input type="text" class="valEmail" style="float: left; width: 347px; margin-right: 10px; vertical-align: top; padding-top: 2px; padding-bottom: 2px;" id="imObjectForm_1_2" name="imObjectForm_1_2" /></div>
                        <div class="imClear" style="height: 1px; line-height: 1px; width: 365px;"></div>
                                    <div style="float: left; margin: 0; padding: 0 0 2px;"><label for="imObjectForm_1_3" style="vertical-align: top; display: inline-block; margin: 3px 0 2px 0; width: 351px;">Address</label><br /><input type="text" class="" style="float: left; width: 347px; margin-right: 10px; vertical-align: top; padding-top: 2px; padding-bottom: 2px;" id="imObjectForm_1_3" name="imObjectForm_1_3" /></div>
                        <div class="imClear" style="height: 1px; line-height: 1px; width: 365px;"></div>
                                    <div style="float: left; margin: 0; padding: 0 0 2px;"><label for="imObjectForm_1_4" style="vertical-align: top; display: inline-block; margin: 3px 0 2px 0; width: 351px;">Address2</label><br /><input type="text" class="" style="float: left; width: 347px; margin-right: 10px; vertical-align: top; padding-top: 2px; padding-bottom: 2px;" id="imObjectForm_1_4" name="imObjectForm_1_4" /></div>
                        <div class="imClear" style="height: 1px; line-height: 1px; width: 365px;"></div>
                                    <div style="float: left; margin: 0; padding: 0 0 2px;"><label for="imObjectForm_1_5" style="vertical-align: top; display: inline-block; margin: 3px 0 2px 0; width: 351px;">Address3</label><br /><input type="text" class="" style="float: left; width: 347px; margin-right: 10px; vertical-align: top; padding-top: 2px; padding-bottom: 2px;" id="imObjectForm_1_5" name="imObjectForm_1_5" /></div>
                        <div class="imClear" style="height: 1px; line-height: 1px; width: 365px;"></div>
                                    <div style="float: left; margin: 0; padding: 0 0 2px;"><label for="imObjectForm_1_6" style="vertical-align: top; display: inline-block; margin: 3px 0 2px 0; width: 351px;">Address4</label><br /><input type="text" class="" style="float: left; width: 347px; margin-right: 10px; vertical-align: top; padding-top: 2px; padding-bottom: 2px;" id="imObjectForm_1_6" name="imObjectForm_1_6" /></div>
                        <div class="imClear" style="height: 1px; line-height: 1px; width: 365px;"></div>
                                    <div style="float: left; margin: 0; padding: 0 0 2px;"><label for="imObjectForm_1_7" style="vertical-align: top; display: inline-block; margin: 3px 0 2px 0; width: 351px;">Activation Key issued</label><br /><input type="text" class="" style="float: left; width: 347px; margin-right: 10px; vertical-align: top; padding-top: 2px; padding-bottom: 2px;" id="imObjectForm_1_7" name="imObjectForm_1_7" /></div>
                                </div>
                            </fieldset>
                            <fieldset>
                                <input type="text" id="imObjectForm_1_prot" name="imSpProt" />
                            </fieldset>
                            <div style="width: 365px; text-align: center;">
                                <input type="submit" value="Send" />
                                <input type="reset" value="Reset" />
                            </div>
                        </form>
                        <script>x5engine.boot.push('x5engine.imForm.initForm(\'#imObjectForm_1\', false, {type: \'tip\', showAll: true, classes: \'validator\', landingPage: \'index.html\', labelColor: \'#000000\', fieldColor: \'#000000\', selectedFieldColor: \'#000000\'})');</script>
                        </div></div>
                    </div>
                    <div style="float: left; width: 377px;">
                        <div style="height: 435px;">&nbsp;</div>
                    </div>

                </div>
                <div style="width: 754px; float: left;">
                    <div style="height: 15px;">&nbsp;</div>
                </div>

                <div id="imFooPad" style="height: 0px; float: left;">&nbsp;</div><div id="imBtMn"><a href="index.html">Home Page</a> | <a href="features-of-footware.html">Features of footware</a> | <a href="download.html">Download</a> | <a href="support.html">Support</a> | <a href="contact-us.html">Contact Us</a> | <a href="imsitemap.html">General Site Map</a></div>                  
                <div class="imClear"></div>
            </div>
            <div id="imFooter">

                <div onclick="x5engine.utils.location('copyright-notice.html'); return false;" style="position: absolute; top: 22px; left: 393px; width: 54px; height: 16px; cursor: pointer;"></div>
                <div onclick="x5engine.utils.location('terms-and-conditions-of-use.html'); return false;" style="position: absolute; top: 22px; left: 468px; width: 113px; height: 16px; cursor: pointer;"></div>
                <div onclick="x5engine.utils.location('privacy-policy.html'); return false;" style="position: absolute; top: 22px; left: 597px; width: 76px; height: 16px; cursor: pointer;"></div>
                <div onclick="x5engine.utils.location('disclaimer.html'); return false;" style="position: absolute; top: 22px; left: 688px; width: 59px; height: 16px; cursor: pointer;"></div>
            </div>
        </div>
        <span class="imHidden"><a href="#imGoToCont" title="Read this page again">Back to content</a> | <a href="#imGoToMenu" title="Read this site again">Back to main menu</a></span>

    </body>
</html>

我强调这不是我的代码。

我想知道我是否需要让我的朋友在网站上使用不同的设置。也许是一些PHP或其他什么。

一如既往,感激不尽的任何帮助。

艾伦......

1 个答案:

答案 0 :(得分:1)

有时您发送的网站发布,不接受&#34;机器人&#34;像Facebook一样这样做。

您是否尝试过发送这样的帖子:

Dim sock As New HTTPSocket Dim d As New Dictionary dim r as string

d.Value(&#34; idA&#34;)=&#34; xpto&#34;

d.Value(&#34; idB&#34;)=&#34; xzy&#34;

d.Value(&#34; idC&#34;)=&#34; abc&#34;

sock.SetFormData(d)

r = sock.Post(&#34; imemail / imEmailForm_160xo79k.php&#34;,30)