2017-07-07 175 views
0

我試圖發送郵件使用下面的代碼的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); 
?> 
+0

你檢查過日誌? –

+0

是的,它表示無法打開流:HTTP請求失敗! HTTP/1.1 500內部服務器錯誤 – Codezzz

回答