【发布时间】:2015-02-18 18:02:21
【问题描述】:
我目前正在使用下面提到的代码来发出 http post 请求,它只返回正文。我想要正文和标题。如何使用 file_get_content 方法或 CURL 获取正文和标题?
$sURL = "url";
$sPD = "data";
$aHTTP = array(
'http' =>
array(
'method' => 'POST',
'header' => "Content-Type: application/atom+xml"
'content' => $sPD
)
);
$context = stream_context_create($aHTTP);
$contents = file_get_contents($sURL, false, $context);
echo $contents;
【问题讨论】:
标签: php post curl http-headers