PHPで作ったPOSTリクエストするためのテスタ
HTTP_Clientでざっくり作ってみる。
<?php /** * @use HTTP_Client */ require_once 'HTTP/Client.php'; // Request URL $url = 'http://localhost/test.php'; // POST data $post_data = '...POST Data...'; // Files $files = array(); // Request header $headers = array( 'Host' => 'hostname', 'User-Agent' => 'PHP Tester', 'Content-Type' => 'application/x-www-form-urlencoded', 'Connection' => 'Close', 'Cache-Control' => 'no-cache', ); $client = new HTTP_Client; $result = $client->post($url, $post_data, true, $files, $headers); $response = $client->currentResponse(); var_dump($result); var_dump($response);