2012-06-28 55 views
0
POST /api/crmteetimeapi.asmx/Login HTTP/1.1 
Host: golffacility.com 
Content-Type: application/x-www-form-urlencoded 
Content-Length: length 

OwnerID=string&UserID=string&Password=string 

我使用哪種語言?如何以這種格式發送HTTP請求?

原諒我的無知

回答

0

任何服務器端語言...

在PHP中:

$host = "golffacility.com"; 
$fp = fsockopen($host, 80, $errno, $errstr, 30); 
if (!$fp) { 
    echo "$errstr ($errno)<br />\n"; 
} else { 
    $content = 'OwnerID=string&UserID=string&Password=string'; 
    $contentLength = mb_strlen($content); 
    $out = "POST /api/crmteetimeapi.asmx/Login/HTTP/1.1\r\n"; 
    $out .= "Host: $host\r\n"; 
    $out .= "Content-Type: application/x-www-form-urlencoded\r\n\r\n"; 
    $out .= "Content-Length: $contentLength\r\n\r\n"; 
    $out .= "Connection: Close\r\n\r\n"; 
    fwrite($fp, $out); 
    while (!feof($fp)) { 
     echo fgets($fp, 128); 
    } 
    fclose($fp); 
} 

在HTML:

<form action="http://golffacility.com/api/crmteetimeapi.asmx/Login" method="post"> 
<input name="OwnerID" value="string"/> 
<input name="UserID" value="string"/> 
<input name="Password" value="string"/> 
<input type="submit"/> 
</form> 

然後點擊 「提交」;)