Sending a HTTP Post from magento 1.6 after custome

2019-04-13 15:05发布

问题:

can anyone point me in the right direction I need to send a HTTP post when a customer registers and or makes a purchase from Magento to a third part server ?

It will be the basic information like name, address, postcode , email ect.

Not sure where to start ?

Many thanks

回答1:

$client = new Varien_Http_Client('http://www.example.com/');
$client->setMethod(Varien_Http_Client::POST);
$client->setParameterPost('name', $name);
$client->setParameterPost('address', $address);
//more parameters
try{
    $response = $client->request();
    if ($response->isSuccessful()) {
        echo $response->getBody();
    }
} catch (Exception $e) {
}