且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用PHP简单的HTML DOM解析器之前登录网站ASP

更新时间:2022-03-12 22:25:37

首先,你应该张贴有:

<?php
function do_post_request($url, $data, $optional_headers = null)
{
  $params = array('http' => array(
              'method' => 'POST',
              'content' => $data
            ));
  if ($optional_headers !== null) {
    $params['http']['header'] = $optional_headers;
  }
  $ctx = stream_context_create($params);
  $fp = @fopen($url, 'rb', false, $ctx);
  if (!$fp) {
    throw new Exception("Problem with $url, $php_errormsg");
  }
  $response = @stream_get_contents($fp);
  if ($response === false) {
    throw new Exception("Problem reading data from $url, $php_errormsg");
  }
  return $response;
}

这应该能够发送POST请求。在这之后,你应该能够抓住你所需要的。

That should be able to send a post request. After that, you should be able to grab what you need.