We are in the process of migrating this forum. A new space will be available soon. We are sorry for the inconvenience.

E3-ssd-4


Network
30-01-2015, 15:14
Quote Originally Posted by HostRange
Install git on a Linux

Clone the script

Edit the script

define('NOTIFICATION_EMAILS', 'YOUR_EMAIL@DOMAIN.COM'); - Change this line to your email address

$zone_to_check = array('143sys13','143sys10'); //Replace with your choices - Change this to the server you want to get notifications for. According to http://ws.ovh.com/dedicated/r2/ws.di...tAvailability2 E3-SSD-4 is '143sys12'

then run the script with "php check-availability.php"

I pasted it here also http://pastebin.com/bq5vM2By

If sys-avail-cache.txt is created in the folder after you run the script it's working.
I can not run :/

what I did;

1- yum install git
2- nano check-availability.php
3- check-availability.php into
Code:
answer->availability;
 
$str_avai = '';
$zone_to_check = array('143sys12'); //Replace with your choices
 
foreach($avail as $s) {
  if( in_array($s->reference, $zone_to_check)) {
    $z = $s->zones;
    foreach($z as $zone) {
 
// Please check your best zone here http://proof.ovh.net/
      if($zone->availability!=='unavailable' && strtolower($zone->zone) == 'bhs' || $zone->availability!=='unavailable' && strtolower($zone->zone) == 'gra' || $zone->availability!=='unavailable' && strtolower($zone->zone) == 'rbx' || $zone->availability!=='unavailable' && strtolower($zone->zone) == 'sbg')
        {
        $str_avai .= $s->reference . " is " . $zone->availability . " in " . $zone->zone . "\n";
      }
    }
  }
}
 
//-- write to cache file to avoid repeated notifications
$previous_message = @file_get_contents(TEMP_PREVIOUS_MSG_FILE);
 
if ($str_avai != ''){
    if ($str_avai != $previous_message){
        if (defined(NOTIFICATION_EMAILS)){
                $emails = explode(',',NOTIFICATION_EMAILS);
        foreach ($emails as $email)
                        sendNotificationEmail($email, $str_avai);
        }
    $ff = fopen(TEMP_PREVIOUS_MSG_FILE, "w");
        fwrite($ff, $str_avai);
        fclose($ff);
    }
}else {
        $ff = fopen(TEMP_PREVIOUS_MSG_FILE, "w");
        fwrite($ff, '-');
        fclose($ff);
}
 
/**
 * Send email via MANDRILL APP
 */
function sendNotificationEmail($to, $msg){
       
if (defined('MANDRILL_API') && MANDRILL == 1) {
        require dirname(__FILE__) . '/vendor/autoload.php';
        $mandrill = new Mandrill(MANDRILL_API);
 
        $date = new DateTime('now', new DateTimeZone('America/Caracas')); // replace your timezone here
 
        $message = new stdClass();
        $message->text = $msg;
        $message->subject = $date->format('Y-m-d H:i:s') . " -  SoYouStart Availability";
        $message->from_email = "no'reply@example.com";
        $message->from_name  = "NO REPLY";
        $message->to = array(array("email" => $to));
        $message->track_opens = true;
 
        $response = $mandrill->messages->send($message);
}
if ( SYSTEM_EMAIL == 1 ) {
        $mail = mail($to, $message->subject, $msg);
}
        return ;
}
4- php check-availability.php
error! ( PHP Parse error: syntax error, unexpected T_STRING in /root/check-availability.php on line 14 )

What should I do?

HostRange
30-01-2015, 13:04
Install git on a Linux

Clone the script

Edit the script

define('NOTIFICATION_EMAILS', 'YOUR_EMAIL@DOMAIN.COM'); - Change this line to your email address

$zone_to_check = array('143sys13','143sys10'); //Replace with your choices - Change this to the server you want to get notifications for. According to http://ws.ovh.com/dedicated/r2/ws.di...tAvailability2 E3-SSD-4 is '143sys12'

then run the script with "php check-availability.php"

I pasted it here also http://pastebin.com/bq5vM2By

If sys-avail-cache.txt is created in the folder after you run the script it's working.

Network
29-01-2015, 23:15
Quote Originally Posted by HostRange
How does it work?

HostRange
29-01-2015, 21:57
https://gist.github.com/Richzendy/ec744e4aa38bf10e1767 maybe a good tool

Network
29-01-2015, 21:12
Quote Originally Posted by Criot
stock opens but does not send e-mail.

Criot
29-01-2015, 16:14
http://kimi.nwwebsites.co.uk/

Network
29-01-2015, 15:52
I could not catch a kind of stock, how do I get notified when stock comes?