Jump to content

CURL Help! Update Database From Another Site


sweetguyzzz

Recommended Posts

Hi to all,

 

I am trying to get following result for my site and I have created a script for it but half script is working and half is not working.

 

1) My Credit Card merchant send a POST request to one of my site's page. For example lets take my site name mysite1.com so they send POST request to this site.

2) I created a CURL script to send POST request to my another site (i.e. mysite2.com), on a page where my Credit Card Merchant send a request.

3) Then on mysite2.com, I create script to update database records of mysite2.com and send emails to both administrator and customer.

Summary of above is as:

Credit Card Merchant Send POST request to mysite1.com >> mysite1.com send CURL POST request to mysite2.com >> mysite2.com updates database records and send emails.

 

Now problem is here that both customer and administrator is receiving emails but database records got not updated, I thought that there may be a problem in query (like some special character) so I created a backup table and tried to insert that query in the backup table but now I see that on another order, not a backup table have any record and not a order table have any record updated.

 

I do not figure out what exactly the problem is.

 

 

I use following code on mysite1.com

<?php
extract($_POST);

if($transactionType=="something") {
  $URL="http://www.mysite2.com/receive.php";
  $ch = curl_init();
  $POST = "fname=$firstName&lname=$lastName&amount=$invoiceChargeAmount&orderid=$orderId&email=$email";
  curl_setopt($ch, CURLOPT_URL,"$URL");
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $POST);
  $result = curl_exec($ch);
  curl_close ($ch);
}

?>

 

 

I am very thankful in advance to those who can help. Waiting for serious responses.

 

Thanks

Sweetguyzzz

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.