Giovany Vecchi wrote:In several cases when sending content the correct POST would be
Try like this:
ohttp:Open( "POST" ,"http://www.w3schools.com/angular/customers.php", .F. )
#include "FiveWin.ch"
#Define cUrl "http://www.w3schools.com/angular/customers.php"
FUNCTION Main()
LOCAL cHtml, oServer, cStringCookie
#ifdef __XHARBOUR__ // xHarbour
Try
oServer := CreateObject( "MSXML2.ServerXMLHTTP.6.0" )
Catch
MsgInfo( 'Erro na Criação do Serviço' )
RETURN NIL
End
#else
Try
oServer := win_OleCreateObject( "MSXML2.ServerXMLHTTP.5.0" )
Catch
MsgInfo( 'Erro na Criação do Serviço!', 'Atenção!' )
RETURN NIL
End
#endif
Try
oServer:Open( "POST", cUrl, .F. )
Catch
MsgInfo( 'Erro na Conexão com o Site ' + cUrl )
RETURN .F.
End
oServer:SetRequestHeader( "Content-Type", "application/x-www-form-urlencoded" )
oServer:SetRequestHeader( "Connection", "keep-alive" )
Try
oServer:Send()
oServer:WaitForResponse( 500000 )
Catch
MsgInfo( 'Erro na Resposta com o Site ' + cUrl )
RETURN( .F. )
End
cHtml := oServer:ResponseBody
cStringCookie := oServer:getResponseHeader("Set-Cookie")
MemoWrit( 'SiteA.txt', cHtml )
xBrowse( "SiteA.txt" )
RETURN NIL
Otto wrote:Thank you, João. Your code is working fine here.
Best regards,
Otto
Otto wrote:Silvio,
No, I tested with WINDOWS 10. But the initial sample didn't work. Now all works fine.
https://support.microsoft.com/en-us/windows/windows-7-support-ended-on-january-14-2020-b75d4580-2cc7-895a-2c9c-1466d9a53962
Best regards,
Otto
Error description: (DOS Error -2147352567) WINOLE/1007 Download della risorsa specificata non riuscito.
(0x800C0008): msxml3.dll
c:\Windows\System32\msxml3.dll
c:\Windows\System32\msxml3r.dll
c:\Windows\System32\msxml6.dll
c:\Windows\System32\msxml6r.dll
c:\Windows\SysWOW64\msxml3.dll
c:\Windows\SysWOW64\msxml3r.dll
c:\Windows\SysWOW64\msxml6.dll
c:\Windows\SysWOW64\msxml6r.dll
<!DOCTYPE html>
<html lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<script>
const http = new XMLHttpRequest()
const url = "https://www.w3schools.com/angular/customers.php";
http.open('get', url, true);
http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
http.onload = function () {
if(http.status === 200 || http.status == 0) {
alert("succeed")
console.log(http.responseText);
alert( http.responseText )
}
}
http.onerror = function () {
alert("failed")
};
http.send();
</script>
</body>
</html>
karinha wrote:Compile con: -w3 -es2
Mira tu Windows 7 64 bits, se está asi:
- Code: Select all Expand view
c:\Windows\System32\msxml3.dll
c:\Windows\System32\msxml3r.dll
c:\Windows\System32\msxml6.dll
c:\Windows\System32\msxml6r.dll
c:\Windows\SysWOW64\msxml3.dll
c:\Windows\SysWOW64\msxml3r.dll
c:\Windows\SysWOW64\msxml6.dll
c:\Windows\SysWOW64\msxml6r.dll
with payment I not have money
https://certified.windowserrorhelp.com/automatically-repair-windows-errors/?error=DLL%20File%20Errors&gclid=CjwKCAiA6aSABhApEiwA6Cbm____18ORQFVSOXeRzMLga4u68HeEhTPhJG56wA8y5LGUk5s9WNgpRBoCv8AQAvD_BwE
Regards.
oServer := CreateObject( "MSXML2.ServerXMLHTTP.6.0" )
oServer:SetTimeouts(40000,40000,40000,40000)
with payment I not have money
// \SAMPLES\NAGES2.PRG
#include "FiveWin.ch"
#define cUrl "http://www.w3schools.com/angular/customers.php"
FUNCTION Main()
LOCAL cHtml, oServer, cStringCookie
#ifdef __XHARBOUR__ // xHarbour
Try
oServer := CreateObject( "MSXML2.ServerXMLHTTP.6.0" )
oServer:SetTimeouts(40000,40000,40000,40000)
Catch
MsgInfo( 'Erro na Criação do Serviço' )
RETURN NIL
End
#else
Try
oServer := win_OleCreateObject( "MSXML2.ServerXMLHTTP.5.0" )
oServer:SetTimeouts(40000,40000,40000,40000)
Catch
MsgInfo( 'Erro na Criação do Serviço!', 'Atenção!' )
RETURN NIL
End
#endif
Try
oServer:Open( "POST", cUrl, .F. )
Catch
MsgInfo( 'Erro na Conexão com o Site ' + cUrl )
RETURN .F.
End
oServer:SetRequestHeader( "Content-Type", "application/x-www-form-urlencoded" )
oServer:SetRequestHeader( "Connection", "keep-alive" )
Try
oServer:Send()
oServer:WaitForResponse( 500000 )
Catch
MsgInfo( 'Erro na Resposta com o Site ' + cUrl )
RETURN( .F. )
End
cHtml := oServer:ResponseBody
cStringCookie := oServer:getResponseHeader("Set-Cookie")
MemoWrit( 'SiteA.txt', cHtml )
xBrowse( "SiteA.txt" )
RETURN NIL
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: George, Google [Bot], nageswaragunupudi and 25 guests