private function __post_ file_get_contents()
{
$url = 'http://qiita.com/';
// POSTデータ
$data = array(
"param1" => "1",
"param2" => 2
);
$data = http_build_query($data, "", "&");
// header
$header = array(
"Content-Type: application/x-www-form-urlencoded",
"Content-Length: ".strlen($data)
);
$context = array(
"http" => array(
"method" => "POST",
"header" => implode("\r\n", $header),
"content" => $data
)
);
$html = file_get_contents($url, false, stream_context_create($context));
return html;
}
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme