Search code examples
phppingopayo

Ping sagepay to see if down


i have been developing my own e-commerce framework for a while now and am now coding up the checkout. I want to use sagepay to process the payments as it is what I have used for a while. But I have haad one or to phone calls in the past saying customers where not able to process there payments due to sagepay being down. It was not down for very long but I thought to overcome this i'll add a backup payment method such as paypal. Due to paypal's high commission, I dont really want to add both options together, and only offer it when sagepay is down. So my question being, is there a way of pinging sagepay to tell whether it is down or not?

p.s. in PHP


Solution

  • If you have a unix/linux underlying and enough rights you can simply evaluate

    exec('ping sagepayserver');

    or you try to reach the server via fsockopen().

    http://de.php.net/manual/en/function.fsockopen.php