Skip to main content
Topic: onclick action in add.php  (Read 2585 times) previous topic - next topic

onclick action in add.php

Hi, is it possible to perform a curl or http get to a url/API when click on the submit button?

Re: onclick action in add.php

Reply #1
@andrewmak‍ yes it is possible. you need to add your curl request on action after add or action before add for add page and action after edit or action before edit for edit page, phprad has provided a function to handle that easily, http_get("URL HERE").

Re: onclick action in add.php

Reply #2
do you mean write the code directly to the php file or using the visual options in phprad?

can you provide a sample of the http_get(URL) of the add.php file?

thanks a lot

Re: onclick action in add.php

Reply #3
@andrewmak‍ Using the visuals. Please, you can locate it on the add page properties or edit page properties. The code I sent in previous message is a sample code, u just have to replace the URL HERE with the link you want to make a get request on.
Code: [Select]
$res = http_get(“google.com”);
Also check on View Help menu, for helper functions you can use within phprad.

 

Re: onclick action in add.php

Reply #4
Thanks A lot, see it now.

One question... if i need to pass param in the url (API), how to do it?

for example my param in phprad is
Code: [Select]
$data['loc']


my url look like this

http://www.domain.com/api?&location='?'

how to use the variable in the API url? thanks