douseda0009 2018-09-11 18:36
浏览 76
已采纳

需要使WordPress表单提交触发一个在其他站点上注册新用户的进程

My problem is:

I have a WordPress website and I want it to work so that every time somebody registers him/herself as a New User on my WordPress site, it triggers a process which takes their login credentials from my WordPress site and uses them to create a new user on a second site, using those same credentials. The second site is a process management tool and is password protected. So this process / script would have to log in to the second site using my login credentials, navigate to the new sub-user registration form and paste in the credentials and submit the form.

I have tried a couple different methods for this already, so far unsuccessful and am unsure what to do next. The second site is called Pruvan. I have checked with them and their API does not support new sub-user registration. I have also tried writing a script that would sit on the Front-End of the WordPress site, gather the new user's login credentials from the DOM, and then make an HTTP Post request to Pruvan's server API. This also did not work. I'm not sure exactly the reason why, but I think it is because Pruvan does not support Cross-Origin Resource Sharing.

I'm trying to find a solution for this problem. Right now I have a vague idea of using a testing framework (such as Selenium) to make a virtual user go to the Pruvan website, log in, and create the sub-user using the login credentials collected from the DOM. The issue I'm having here is that I have no idea how to start making this work with the WordPress Back-End. I have very little experience working with WordPress or PHP and would greatly appreciate some suggestions or a roadmap / blueprint of how you would approach this problem.

Thanks.

  • 写回答

1条回答 默认 最新

  • dooo61733 2018-09-11 19:20
    关注

    I also believe that doing this using Selenium would not be right thing.

    However, if you have not found a good solution and looking at this approach as a stop gap arrangement, here is how you can do this using Selenium:

    • You may write a simple cron job that monitors your WordPress database for user registration
    • If the cron detects a new user registration, it triggers your selenium script.

    You may create a jar file or similar executable for the selenium script which can be triggered as a job with username and password as parameters. For example, if you have created a jar titled InputInPMS.jar, then you may trigger the jar using command:

    InputInPMS.jar <username> <password>

    Alternatively, you may use a build tool like jenkins to trigger a custom job through job link and passing username and password as parameters in the link to trigger job.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码