doutan5337 2016-03-30 00:59
浏览 5
已采纳

将变量发送到第三方在线表格

In golang, is there a way to pipe a variable to part of a web form?
For example, sending "123 Random St." to the Street address part of https://www.dominos.com/en/pages/order/#/locations/search/ and so on? I found pizza_party*, but the GUI used is no longer available, I have also found pizzadash**, but this uses a credit card where I want to use cash. I even found a list of golang ones, but the links that they use doesn't work anymore.***
Therefore, my goal is so: order a pizza in golang through the dominos website API!

NOTE: Please suggest a package or function with example!

NOTE: I do not want to make a web scraper/data getter.

NOTE: Your answer must work on at least one box of my linked website.

NOTE: I want to fill out links similar to the provided link from the linux command line.

*https://github.com/coryarcangel/Pizza-Party-0.1.b
**https://github.com/bhberson/pizzadash
***https://golanglibs.com/top?q=pizza

  • 写回答

2条回答 默认 最新

  • duanchen7036 2016-04-03 06:36
    关注

    This is how you post any form values onto an online form. Provided you know the POST endpoint of the service.

    func main():
    
       resp, err := http.PostForm(targetPostUrlHere,
        url.Values{"Service_Type": {"Delivery"}, 
            "Address_Type_Select": {"House"}, 
            "Street": {"123 E 24th St"}, 
            "Address_Line_2": {"4D"}, 
            "City": {"New York"},
            "Region": {"NY"},
            "Postal_Code": {"10027"}})
    
    }
    

    **Note: The field keys and values are guesstimates. You must inspect the actual key names expected in the form.

    In your case, https://www.dominos.com/en/pages/order/ is an endpoint for the form page. Once the form is filled and submitted, the information is submitted using POST method akin to the code afore-mentioned to a dedicated CREATE endpoint (C in the CRUD), which normally can be found in the <form> html tag.

    <form action="posttargetendpoint" method="POST">...</form>
    

    Once the POST operation is successful, usually a web service would redirect you to another page. In your case, it is https://www.dominos.com/en/pages/order/#/section/Food/category/AllEntrees/

    However, any good web service wouldn't expose the POST endpoint in the clear since it is the vulnerable point of attack. You're welcome to find out by inspect he Domino's page source and adjust the field values in the Go code accordingly.

    Now to make a command line prompt to wrap around the PostForm code, I suggest you look into https://github.com/codegangsta/cli which is a very nice package for creating quick command line app.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗
  • ¥15 ikuai客户端l2tp协议链接报终止15信号和无法将p.p.p6转换为我的l2tp线路