Quantcast
Channel: DreamFactory Forum - Latest posts
Viewing all articles
Browse latest Browse all 5027

PHP scripting to POST to external MySQL for new registrations

$
0
0

Hi @charliefinale,

if I understand what you're saying, you will need a Custom Script that receives the POST of your PHP code. The routine is:
PHP -> Script DF -> Save to DF Users -> Save to MySql Users

So, what you could do is:

  1. Make your PHP code call the DF user/register with the user data to the DF db and the data to MySql db.
  2. In scripts you have the post and pre process, there(IMO pre_process, because if it fails you stop the requisition right away) you need to make a V8js script to call your mysql db service to save in your db: platform.api.get('you_service/method/some_options_if_needed', user_data);

Example of requisition:

var new_user = platform.api.post('my-db-service/users?fields=id,name,email,login', user_data);

where user_data:

var user_data = {
  "login": params.login,
  "email": params.email,
  "name": params.name,
  encrypted_password: {
    expression: 'MD5("' + params.password + '")'
  },
  created_at: {
    expression: 'NOW()'
  },
  updated_at: {
    expression: 'NOW()'
  }
};

expression is for execute SQL commands in the query to that field.

Where is the post process:


Viewing all articles
Browse latest Browse all 5027

Trending Articles