简体   繁体   English

如何向使用POST方法的公共网站发送请求以及如何查找请求的参数,如源和目的地等

[英]How to send a request to public website which uses POST method and how to find out parameters of the request like source and destination etc

I want to collect data of trains for the given 'source and destination' pairs from an public website. 我想从公共网站收集给定“来源和目的地”对的列车数据。 I don't want to do this manually, but from the code and automate it. 我不想手动执行此操作,而是从代码中自动执行此操作。 I know it uses POST method. 我知道它使用POST方法。 But how do i send my input to the page? 但是我如何将我的输入发送到页面? i don't know post parameters it uses! 我不知道它使用的帖子参数! Is it possible anyway how to find this.. solutions are much appreciated. 是否有可能如何找到这个..解决方案非常感谢。

最好的解决方案是使用他们的API,如果他们提供它,否则我将carfull未经他们的许可从网站获取信息。

Use the site like you normally would with the network tab in your browser's dev tools open. 像浏览器的开发工具中的网络选项卡一样,使用网站。 When the site makes the request, you can inspect the headers and body of the request. 当站点发出请求时,您可以检查请求的标头和正文。 If they didn't release an api they probably don't want you doing this though. 如果他们没有发布api,他们可能不希望你这样做。

You might want to try to incorporate post-receive programming similar to that used for Github webhooks for your program. 您可能希望尝试将类似于Github webhooks的post-receive编程合并到您的程序中。 Take a look here: https://github.com/aegypius/github-webhook-php 看看这里: https//github.com/aegypius/github-webhook-php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM