简体   繁体   中英

how to execute php script in ios parse-server side?

my iOS swift app is deployed in heroku using Parse SDK, my question is how to execute php script in parse-server side when an action happend in ios app , eg: send confirmation email when new user signup using ios app by executing php script in the server side.

any idea ?

Thanks

Parse server is based on NodeJS and not PHP. the only scripts that you can execute in parse-server should be written in NodeJS. If you have some 3-party scripts written in PHP and those scripts are exposed in REST api you have 2 options:

  1. Call those scripts from within the parse-server cloud code env. (with a very simple NodeJS call to your php rest API)
  2. call those scripts from within your IOS client and handle the results on the client

[EDIT] in order to execute scripts when events occurs (eg user created, class updated etc) you can use cloud code triggers

for example a code that will be executed before a user is saved to the database is (from parse cloud code docs) :

Parse.Cloud.beforeSave(Parse.User, function(request, response) {
  if (!request.object.get("email")) {
    response.error("email is required for signup");
  } else {
    response.success();
  }
}); 

Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM