dongluxin6711 2012-03-19 09:16
浏览 24
已采纳

如何让php脚本填写远程表单并提交?

To make this short, I will show what I need exactly. Here is the site, it shows some info about game stats once entered username and region.

http://riot.control-c.ir/
http://riot.control-c.ir/Summoner/EUW/26233693

How can I make remote submitting these forms to parse pages for different users?

  • 写回答

1条回答 默认 最新

  • dsoy71058 2012-03-19 09:23
    关注

    THis can be done by copying the same http request that the remote form makes when it submits.

    See the following form,

    <form action="submit.php" method="post">
    <input type=text name="username" />
    <input type=text name="password" />
    <input type=submit name="submit" value="Submit"/>
    </form>
    

    When this form is submitted there is an http request sent to submit.php on the remote host with post method. and in the body these fields reside.

    username=MYUSERNAME&password=MYPASSWORD&submit=Submit
    

    The http request looks like

    POST submit.php
    Host: remotehost.com
    Accpet: */*
    Content-Type: x-www-form-urlencoded
    Content-Length: 43
    
    username=MYUSERNAME&password=MYPASSWORD&submit=Submit
    

    All you have to do is mimic this request.

    Curl is a popular library for this task.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化