0

Suppose I have a wordpress site live and it contains a custom form i.e to collect user's data for checkout of the product, but the data collected will be submitted to a given url (e.g., http://example.com) not on the wordpress site itself.

Is it possible? What to do?

2

1 Answer 1

0

Cross-domain POSTing, GETing is allowed.

So you can easily use form action as http://example.com.

Ex:

<form action="http://example.com">
4
  • What hosted in different domain?
    – Fil Joseph
    Commented Nov 10, 2016 at 13:33
  • So what is the problem if it is in different domain? for a example you have a form in example1.com. you need to send form data to example2.com. So form of example1.com action will be example2.com. <form action="http://example.com2" method="post">. Then you can access form data using $_POST['name'] in example2.com. Or have I misunderstand the question?
    – Ranuka
    Commented Nov 10, 2016 at 15:28
  • You understand it right, I just read some security measure regarding this. But how to get data from other domain?
    – Fil Joseph
    Commented Nov 10, 2016 at 15:42
  • You have to just put $_POST['name'] to get data in other domain. Even it on same domain you can't never trust user input values like $_POST['name'] or $_GET['name']. You have to validate them.
    – Ranuka
    Commented Nov 10, 2016 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.