0
<html>
<body><input type="button" id="send" value="Send"></body>
</html>
有会在我的HTML按钮ASP.Net的Web API, 当它被点击,我想连接到http://localhost:81/Help/Api/POST-Login 这是我的API。 然后我想发布数据。 现在很困惑,任何想法的家伙。在此先感谢发送HTTP POST请求使用PHP
<?php
$url = "http://localhost:81/Help/Api/POST-Login";
$data = array(
'message' => 'hi,
mobile' => 12345678,
);
$options = array(
'http' => array(
'method' => 'POST',
'content' => json_encode($data),
'header'=> "Content-Type: application/json\r\n" .
"Accept: application/json\r\n"
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$response = json_decode($result);
使用cURL为这种转移。 – tilz0R