PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WEBDEV 23 → API data from httprequest in PHP
API data from httprequest in PHP
Débuté par Ruan, 08 aoû. 2018 10:14 - 3 réponses
Membre enregistré
172 messages
Popularité : +1 (1 vote)
Posté le 08 août 2018 - 10:14
Good day

I have a PHP project and I am trying to call an API with header data. When I use it in a Webdev Project it works 100%

cMyRequest is httpRequest
cMyRequest..URL = "https://stuff.com/15537?fields=*"
cMyRequest..Header["user-key"] = "7333555822145441"
cMyResponse is httpResponse
cMyResponse = HTTPSend(cMyRequest)

vMainData is Variant
vMainData = JSONToVariant(cMyResponse.Content)


But cannot do this in PHP. Can anyone push me in the correct direction as how to get the same outcome in PHP.

Thanks

Ruan
Posté le 08 août 2018 - 13:53
Hi Ruan

AFAIK, not a lot of people are using the PHP mode (it's the least
powerful of the 3 dynamic modes) so I'm not sure anybody here will have
been in your exact case.

Add to that the fact that you do NOT tell us ANYTHING about the problem
you are encountering, and you are setting yourself up for a long moment
of silence.

So.... Error message? Compilation problem? Incorrect return?

Best regards

Fabrice

On 8/8/2018 2:14 AM, Ruan wrote:
Good day

I have a PHP project and I am trying to call an API with header data.
When I use it in a Webdev Project it works 100%

cMyRequest is httpRequest
cMyRequest..URL = "https://stuff.com/15537?fields=*"
cMyRequest..Header["user-key"] = "7333555822145441"
cMyResponse is httpResponse
cMyResponse = HTTPSend(cMyRequest)

vMainData is Variant
vMainData = JSONToVariant(cMyResponse.Content)


But cannot do this in PHP. Can anyone push me in the correct direction
as how to get the same outcome in PHP.

Thanks

Ruan
Membre enregistré
172 messages
Popularité : +1 (1 vote)
Posté le 10 août 2018 - 09:30
Fabrice Harari wrote:
Hi Ruan

AFAIK, not a lot of people are using the PHP mode (it's the least
powerful of the 3 dynamic modes) so I'm not sure anybody here will have
been in your exact case.

Add to that the fact that you do NOT tell us ANYTHING about the problem
you are encountering, and you are setting yourself up for a long moment
of silence.

So.... Error message? Compilation problem? Incorrect return?

Best regards

Fabrice

On 8/8/2018 2:14 AM, Ruan wrote:
Good day

I have a PHP project and I am trying to call an API with header data.
When I use it in a Webdev Project it works 100%

cMyRequest is httpRequest
cMyRequest..URL = "https://stuff.com/15537…=*"
cMyRequest..Header["user-key"] = "7333555822145441"
cMyResponse is httpResponse
cMyResponse = HTTPSend(cMyRequest)

vMainData is Variant
vMainData = JSONToVariant(cMyResponse.Content)


But cannot do this in PHP. Can anyone push me in the correct direction
as how to get the same outcome in PHP.

Thanks

Ruan


Hi Fabrice

There is no error. Webdev doesn't have this function in PHP: cMyRequest is httpRequest.
That is why I want to know what is the correct method to do this in PHP. I am building this for a client and can only do it in PHP. They don't have a webserver.

Thanks

Ruan
Posté le 10 août 2018 - 12:21
Hi Ruan,

if they don't have a webserver, they wont be able to use php pages any
more than a webdev classic or awp site.

If you mean that they are going to use a free/cheap hosting service
accepting only php, be aware that yo can host a webdev classic or awp
site with HFCS for as little as 5€/month (kalanda.net, by example), so
that is a non problem.

and now that the question is clear, the answer is httprequest (the
function) and not httprequest, the newer variable type

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Free Video Courses, free WXShowroom.com, open source WXReplication, open
source WXEDM.

More information on http://www.fabriceharari.com


On 8/10/2018 1:30 AM, Ruan wrote:
Fabrice Harari wrote:
Hi Ruan

AFAIK, not a lot of people are using the PHP mode (it's the least
powerful of the 3 dynamic modes) so I'm not sure anybody here will have
been in your exact case.

Add to that the fact that you do NOT tell us ANYTHING about the problem
you are encountering, and you are setting yourself up for a long moment
of silence.

So.... Error message? Compilation problem? Incorrect return?

Best regards

Fabrice

On 8/8/2018 2:14 AM, Ruan wrote:
Good day

I have a PHP project and I am trying to call an API with header data.
When I use it in a Webdev Project it works 100%

cMyRequest is httpRequest
cMyRequest..URL = "https://stuff.com/15537…=*"
cMyRequest..Header["user-key"] = "7333555822145441"
cMyResponse is httpResponse
cMyResponse = HTTPSend(cMyRequest)

vMainData is Variant
vMainData = JSONToVariant(cMyResponse.Content)


But cannot do this in PHP. Can anyone push me in the correct direction
as how to get the same outcome in PHP.

Thanks

Ruan

Hi Fabrice

There is no error. Webdev doesn't have this function in PHP: cMyRequest
is httpRequest.
That is why I want to know what is the correct method to do this in PHP.
I am building this for a client and can only do it in PHP. They don't
have a webserver.

Thanks

Ruan