Boa tarde, estou com um probleminha aqui no meu trabalho, me passaram um código php para "transformar' em asp... o problema é que eu sei muito pouco de asp, eu estou tentando mais não esta saindo como eu gostaria, alguém poderia dar uma olhada nos 2 códigos php e asp e ver como poderia me ajudar, ou dar um toque... desde já agradeço :) PHP: <?
function post($host,$porta,$path,$query) {
$fp = fsockopen($host, $porta);
// echo "$host $path $query $porta";
echo($query);
if (!$fp){
return false;
}
fputs($fp, "POST $path HTTP/1.1\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($fp, "Content-length: " . strlen($query) . "\r\n");
fputs($fp, "Connection: close\r\n\r\n");
fputs($fp, $query);
$retorno = "";
while (!feof($fp)) {
$retorno.=fgets($fp,128);
}
fclose($fp);
return $retorno;
}
?>
ASP:
<%
Function post(host,porta,path,query)
Set fp = server.CreateObject("scripting.FileSystemObject")
arquivo= request.serverVariables("APPL_PHYSICAL_PATH") & "arquivo.txt"
Set Out=fp.OpenTextFile(Server.MapPath("arquivo.txt"),2, True)
Out.write(arquivo & "POST path HTTP/1.1\r\n")
Out.write(arquivo & "Host: host\r\n")
Out.write(arquivo & "Content-type: application/x-www-form-urlencoded\r\n")
Out.write(arquivo & "Content-length: " & "query.length" & "\r\n")
Out.write(arquivo & "Connection: close\r\n\r\n")
Out.write(arquivo & query)
retorno = ""
Do While (Server.MapPath("arquivo.txt")).eof = false
retorno = retorno & fso.GetFile(arquivo,128)
Loop
arquivo.close
fpost = retorno
End Function
%>