我试图发送邮件使用下面的代码的HTTP请求的URL,一个URL,但一直得到错误发送一个HTTP请求,使用PHP
(的file_get_contents(http://localhost:81/Help/Api/POST-SMS):未能 打开流: HTTP请求失败!HTTP/1.1 500内部服务器错误)
,有什么想法? 预先感谢
<?php
$url = 'http://localhost:81/Help/Api/POST-SMS';
$data = array('message' => 'hi', 'mobile' => '12345678');
$options = array(
'http' => array(
'header' => "Content-type: application/json",
'method' => 'POST',
'content' => http_build_query($data)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) { /* Handle error */ }
var_dump($result);
?>
你检查过日志? –
是的,它表示无法打开流:HTTP请求失败! HTTP/1.1 500内部服务器错误 – Codezzz