I'm trying to do a form post from another site that is not mine, but I am not able ta give error.
There on the site the post is mounted like this:
<a href="javascript:document.result.submit()" class="lnk-more">Veja o resultado da enquete anterior »</a>
<br /><br />
<form name="result" action="http://enquete.terra.com.br/enquete.cgi" method="post">
<input type="hidden" name="id_enquete" value="144143">
<input type="hidden" name="opcao" value="0">
</form>
And I'm riding in the asp script to make this post as:
<%
Dim objHttp
Dim str
str = "id_enquete=144143&opcao=0"
Set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
objHttp.Open "POST", "http://enquete.terra.com.br/enquete.cgi", false
objHttp.setRequestHeader "Host", "http://enquete.terra.com.br"
objHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded; charset=iso-8859-1"
objHttp.setRequestHeader "Content-Length", Len(str)
objHttp.Send str
Response.Write(objHttp.ResponseText)
Set objHttp = nothing
%>
But not this working, does anyone know how or know where I am wrong??
Thanks
Code looks true; the reason why you get "Internal Server Error" is because your IIS settings for error is not in the debug mode.
You should change your IIS settings to "Send error messages to Browser" then you can see the actual error message on the browser; which is probably caused by version of the Msxml2.ServerXMLHTTP object.
You can't make cross domain request using AJAX due to the same origin policy. If the other site supports JSONP, you can use a script request to access the site and get data from it, of course, your parameters need to be in the URL for that to work.