Well, the easy way is to just use CURL. It is intended to allow PHP to post data to external sites. It is quite
easy to use once you set it up correctly. You will need to know what data you need to post to the second site.
And, what data will be returned from the second site.
Here is a sample of CURL code that I use to post on one of my sites to a secondary site that returns data from
it’s database. You would need to read the returned data from the other site and determine if it was valid or if it
contains an error message. Not sure if this is what you want, but, I think it will work for you…
[php]
// Set up connection to second server…
$url = “http://sms.vndsms.com/vendorsms/pushsms.aspx”;
// Data to be passed to the secondary server…
$fields = array(
“user” => “abc”,
“password” => “xyz”,
“msisdn” => “919898xxxxxx”,
“sid” => “SenderID”,
“msg” => “test%20message”,
“fl” => “0”,
“gwid” => “2”,
);
// Build the urlencoded data
$postvars = http_build_query($fields);
// Open connection
$ch = curl_init();
// Set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FAILONERROR,true);
// Execute post
$result = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
// Check for errors (in the returned from the secondary server)
[/php]
This is altered for the data you showed us. You need to check the $error variable to see if the CURL failed.
Also, you would need to echo or check the results that was sent back from the other server. This is stored in
the $result variable and sometimes this will hold an error. In other words, the $error is for CURL errors and the
$result is what the second server sends back to you which might be an error message or a “successful” msg.
Hope this is what you are looking for… Good luck…