PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → cURL and WD21
cURL and WD21
Débuté par Jim Carson, 26 oct. 2016 15:12 - 6 réponses
Posté le 26 octobre 2016 - 15:12
Has anyone used cURL with Windev to process HTTPrequest's. If so, any hints?
Posté le 26 octobre 2016 - 15:52
Hi Jim

why would we do that? Why not use the native httprequest/httpgetresult/httpform functions?

Best regards
Posté le 26 octobre 2016 - 16:28
I have tried these. The problem is the header that is sent (I think). I can't figure out how to see all of the HTTPrequest details. (Header, Body) The header that is sent is the issue. When I try to get info on the request, I get the error "An element of 'httpRequest' type cannot be converted to the 'ANSI string' type.". From within the ide can I preview the data that is being sent.
Posté le 26 octobre 2016 - 19:05
did you use one httpRequest/httpResponse variables and HTTPSend function?

what is in the Content,Header and Method properties?

http://doc.windev.com/en-US/…
http://doc.windev.com/en-US/…
http://doc.windev.com/en-US/…
Membre enregistré
44 messages
Popularité : +7 (7 votes)
Posté le 26 octobre 2016 - 23:10
Hello My Friend.

check this post: http://forum.pcsoft.fr/fr-FR/pcsoft.br.windev/754-trabalhando-com-httprequest-com-exemplos-que-usam-curl/read.awp…

--
Analista de Sistemas Jr
www.arsistemas.com.br
Pai da Alícia e Marido da Andréa <3
Posté le 27 octobre 2016 - 00:13
Quote
Jim Carson

I can't figure out how to see all of the HTTPrequest details

Hi,
You can use a too likel wireshark, as Fabrice said in another post. It's free and easy to use.

Another way to monitor is to create a socket within windev with SocketCreate() and then send the httprequest to yourself
You can trace the content received by using trace()

So this request (from windev online help):
cMyRequest is httpRequest cMyRequest..URL = "127.0.0.1:5010" //5010 is the port is the port I chosed in SocketCreate() cMyResponse is httpResponse = HTTPSend(cMyRequest)
Shows this trace window:
GET / HTTP/1.1<\ ><\ >User-Agent: PC SOFT Framework<\ ><\ >Host: 127.0.0.1:5010<\ ><\ >Accept: */*<\ ><\ ><\ ><\ >
This is the code used to create the socket:
SocketCreate("Consommation",5010,"127.0.0.1") SocketChangeTransmissionMode("Consommation",SocketNoEndTag)

Apart from monitoring what is being send you will need to test what changes are needed stop the error response.
For that you can use Telnet command, that comes in window (But from windows7 and later you will have to activate it via control panel / add remove programs).

It's very simple to use:
Telnet 127.0.0.1 5010
or
Telnet www.google.com 80

And then write (even if you can see what you are writing) for example:
GET
and press enter, and you will get the full response of the http server

Instead of a simple GET put the full http request.

Regards,
José Antonio.
Posté le 28 octobre 2016 - 18:06
Thank you. Very helpful.