javascript - 在 PHP 中自动填充并从其他页面检索数据

标签 javascript php curl phantomjs

我在 PHP 中遇到问题,请执行以下请求:

  • 运行我的 php 文件,它移至“https://whoer.net/checkwhois
  • 它会自动填写“IP地址或主机名”,即文本“8.8.8.8”,并自动按“检查”
  • 保存整个结果检查

我该怎么做?

最佳答案

您可以从 Linux shell 尝试这个 CURL

curl 'https://whoer.net/checkwhois' -H 'origin: https://whoer.net' -H 'x-requested-with: XMLHttpRequest' -H 'content-type: application/x-www-form-urlencoded; charset=UTF-8' -H 'referer: https://whoer.net/checkwhois' -H 'authority: whoer.net' --data 'partial=1&host=8.8.8.8' --compressed

在 php 中,下面的代码应该可以工作:

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://whoer.net/checkwhois');
curl_setopt($ch, CURLOPT_POST, 2);
curl_setopt($ch,CURLOPT_POSTFIELDS,  'partial=1&host=8.8.8.8');

$result = curl_exec($ch);

//close connection
curl_close($ch);

echo $result;

关于javascript - 在 PHP 中自动填充并从其他页面检索数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40983813/

相关文章:

php - $_POST 和 $_SESSION 哪个更安全?

php json 请求 : json_decode unicode string

php - 当数字被零除时,Try catch 在 Laravel 5.6 中不起作用

ssl - 了解 curl 实现

javascript - Jquery嵌套面板与上面的内容重叠

javascript - 表 : fix thead during scroll

javascript - 根据vuex状态重新加载组件数据

javascript - 如何使用 AngularJS 从 json 数据中删除链接标签

PHP CURL CURLOPT_SSL_VERIFYPEER 被忽略

curl - 为什么我不能使用 LinkedIn API 的命令行 curl 生成有效的 oauth-token?