PDA

View Full Version : httpGetRequest



pacorbett
14-Dec-2023, 06:42 AM
PessoALL,
acho que não entendi o processo com esse comando... Imaginei que ele fizesse o Download do conteúdo da pagina, mas não faz... ele até gera o arquivo a cada execução, mas sempre em branco.
Ou tem alguma coisa a mais para fazer ? Se alguém puder esclarecer... Uso o Vdf 15.1 nesse caso.

Set psRemoteHost of ohHttp to sUrl
//Set piRemotePort of ohHttp to 80
Set psSaveAsFile of ohHttp to sCaminho


Get HttpGetRequest of ohHttp sUrl to iRetVal

Tanto o sUrl quanto o sCaminho existem e são verdadeiros
Grato pela atenção

Samuel Pizarro
14-Dec-2023, 09:17 PM
Qual o valor da sua variavel sUrl ?

olha na documentação da propriedade psRemoteHost e o conteudo da url no metodo httpgetRequest


vc vera q sao 2 coisas diferentes.

o remotehost eh o dominio. ( tudo antes da 1ra barra /)

e a url eh o resto , tudo apos a 1ra barra

Seu request com certeza esta retornando um http 404

pacorbett
15-Dec-2023, 06:40 AM
Qual o valor da sua variavel sUrl ?

olha na documentação da propriedade psRemoteHost e o conteudo da url no metodo httpgetRequest


vc vera q sao 2 coisas diferentes.

o remotehost eh o dominio. ( tudo antes da 1ra barra /)

e a url eh o resto , tudo apos a 1ra barra

Seu request com certeza esta retornando um http 440

Vou ver essas propriedades, Samuel... Obrigado... Mas se eu coloco o valor de sUrl no navegador, ele abre a pagina solicitada sem problemas. E a cada vez que testo, gera um arquivo sCaminho. Por isso imaginava que deveria ter o conteudo da pagina que retorna,.
Ma vou seguir sua sugestão e dar uma olhada com cuidado nas propriedades. Grato
sds

wila
15-Dec-2023, 07:53 AM
Hi,

Also note that the protocol prefix (http:// or https://) is not part of psRemoteHost or the sURL!

You would have something like:


set psRemoteHost To "www.example.com"

Get HTTPGetRequest "/klantenservice/mijn-servicepunt/account/login" to bOk


where you would put in the browser: http://www.example.com/klantenservice/mijn-servicepunt/account/login

for using https you need to set the properties:


Set piRemotePort to rpHttpSSL
Set peTransferFlags to ifSecure


success!
--
Wil

pacorbett
15-Dec-2023, 08:11 AM
Hi,

Also note that the protocol prefix (http:// or https://) is not part of psRemoteHost or the sURL!

You would have something like:


set psRemoteHost To "www.example.com"

Get HTTPGetRequest "/klantenservice/mijn-servicepunt/account/login" to bOk


where you would put in the browser: http://www.example.com/klantenservice/mijn-servicepunt/account/login

for using https you need to set the properties:


Set piRemotePort to rpHttpSSL
Set peTransferFlags to ifSecure


success!
--
Wil

Thanks, Will... my code no longer contains "http", but as Samuel said, it's still giving Error 404. I'll analyze the options. Grateful for the attention.

Samuel Pizarro
15-Dec-2023, 09:30 AM
Mas se eu coloco o valor de sUrl no navegador, ele abre a pagina solicitada sem problemas

mas eh essa exatamente a gramde diferença

Protocolo
remotehost (dominio)
porta
caminho

wila
15-Dec-2023, 10:37 AM
Http error 404 is "The requested resource could not be found"
In other words, the URL is wrong.
Try removing a "/" or something like that.

--
Wil

Marco
15-Dec-2023, 07:22 PM
This is not the first time and won’t be the last.

I suggest that the class raises and error when the http:\\ or https:\\ is passed in, or even better spits it itself and set the ifsecure flag as well.

It’s little things like that, that can make evaluators get discouraged using the product - when it should work - it doesn’t - and there is no error to help.

Samuel Pizarro
15-Dec-2023, 09:40 PM
+10