Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create HTTP Request object
Message
From
21/12/2016 19:41:34
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01645753
Message ID:
01645855
Views:
61
>>>Hi,
>>>
>>>Do you know, and if yes, how, to create an HTTP Request object in VFP?
>>>
>>>TIA
>>
>>Depending on your plans, you can use the ServerXMLHTTP class.
>>
>>
>>LOCAL HttpRequest AS MSXML2.ServerXMLHTTP60
>>LOCAL HttpResponseEndPoint AS String
>>LOCAL Reply AS String
>>
>>m.HttpResponseEndPoint = "https://www.levelextreme.com"
>>
>>m.HttpRequest = CREATEOBJECT("MSXML2.ServerXMLHTTP.6.0")
>>
>>m.HttpRequest.Open("GET", m.HttpResponseEndPoint, .F.)
>>m.HttpRequest.Send()
>>
>>m.Reply = m.HttpRequest.Responsetext
>>
>>? m.Reply
>>
>
>Your code works, as you wrote it. But I need to take just one line from your code, that creates httpRequest and add parameters to it.
>
>
>m.HttpRequest = CREATEOBJECT("MSXML2.ServerXMLHTTP.6.0")
>m.HttpRequest.AddParameter("grant_type", "password")
>
>
>The second line above fails. If you know or can see what is wrong with adding a parameter the way I did, please let me know.

To send POSTed data:
m.HttpRequest.Open("POST", m.HttpResponseEndPoint, .F.)
m.HttpRequest.Send("grant_type=password")
To set request headers:
m.HttpRequest.SetRequestHeader("HeaderName", "HeaderValue")
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform