Page 2 of 2

Re: Retrieve data from a web api in json format

Posted: Thu May 12, 2022 4:49 pm
by kev1n
yvesf wrote: Thu May 12, 2022 4:02 pm curl_init() isn't recognized. Do I have to instanciate something ?
Error? Google?

Re: Retrieve data from a web api in json format

Posted: Thu May 12, 2022 9:16 pm
by yvesf
I know that it doesn't work because I have put it behind an input button under custom code, event onclick.
If I put onclick event the following code :

Code: Select all

$ch=curl_init();
nuMessage('test curl');
--> no message, the system is blocked on the first line.
If I put onclic event :

Code: Select all

$ch='test curl';
nuMessage($ch);
--> the message appears. I conclude that curl_init() isn't recognized. How can I retrieve the error msg ?
Many thanks for your help

Yves

Re: Retrieve data from a web api in json format

Posted: Fri May 13, 2022 12:45 am
by kev1n
You can't run PHP code in the browser. It has to be placed in a procedure.

Re: Retrieve data from a web api in json format

Posted: Sat May 14, 2022 8:14 am
by kev1n
1. Add a Procedure with code e.g. retrieve_data

Builders -> Procedure -> Add
procedure.png


2. To run it, add this JS to a button's onclick event:

Code: Select all

nuRunPHPHidden('retrieve_data', 0);