Have Outside WebForm make entry in Yii App

Is it possible to allow a webpage with a form (unrelated to the yii app itself) post and populate my yii app? I’m not sure what I need to search for, if this is possible, what is the proper term for this type of thing? Is this where I’d need to create an API? Are there any examples I could start from? Any advice?

Thank you!

Yes. That would be just a regular form with action = your Yii app URL. On the Yii side you’ll likely need to turn off CSRF validation for that exact action: yii2-cookbook/csrf.md at master · samdark/yii2-cookbook · GitHub

Before I go down this rabbit hole, is this something I should not be doing? Is this opening me to a major security risk?

And Thank you for taking the time to help me!

Well, you are explicitly allowing third party websites to send info to your site and:

  1. You aren’t verifying which website submits that info.
  2. Third party website may submit that info and it will be authenticated as a currently logged in user.

I believe that building a small API to receive the form’s data with a POST request would be the best way to go.

Using authentication you can ensure that only allowed clients can post data to it.

You can build an API using Yii as separate project or with a another stack like nodejs.

Knowing API fundamentals is essential for any developer nowadays. So, if you know nothing about it, it’s time to learn!

Thank you both.

Looks like I have some learning ahead of me. :grin: