ADiL
ADiL

Reputation: 367

Send Data From my website to an external page of another website using PHP

all my problem is that I wanna send data from my website to this website's page :

http://www.womo.com.au/external-review.php?id=MDAxMTcyNjcw

how I can do this ? and is it possible ? cuz as I have seen this website forms validation's all in javascript and dunno how to handle it ?

thanks.

Upvotes: 1

Views: 1650

Answers (1)

Sizzling Code
Sizzling Code

Reputation: 6070

This is how you can do that, just make a testPosting.html file, Create your form using all the inputs that are required to send. See the screenshot for the posted fields. This data is posted when i submitted the form after filling it.

enter image description here

Now as you can see 14 fields are posted, so you need to make 13 inputs and 1 textarea.

use click function for the button of submit e.g

$('#buttonID').click(function(e){
e.PreventDefault();
//store values of inputs in a variable
var data = {
FirstName = $('#FirstName').val(); // you can more better then that if you know how
//Add the rest of the data
};
});

then you can use jQuery Ajax to send data.

$.ajax({
url: "http://www.womo.com.au/external-review.php?id=MDAxMTcyNjcw",
data:data, //this data will be the variable that you create in which all the forms inputs datas are stored.
type: "POST"
}).done(function(result) {
//do stuff if some result has returned
});

i just gave the rough idea. Oh you must use this line in script on top of you JS scrips

jQuery.support.cors = true; // force cross-site scripting (as of jQuery 1.5)

My code is not perfect but you get the idea what i am trying to say, you might can start from here, and do stuff of your own..

Upvotes: 2

Related Questions