Send your YPN earnings to your cell phone hourly via sms

Discussion in 'Scripts' started by phelixx, Jul 6, 2006.

  1. #1
    I just thought i would share this cool script that i wrote. You can set it up in cron to run whenever you like and it will login to your YPN account grab your Daily total and sms the results to your cell phone. Kinda handy just thought i would share it with you all.


    <?
    $username="someusername";
    $password="somepassword";
    $cookie="/home/someplace/cookiefile.txt";
    $log="/home/someog/ypn.log.txt";
    $destination="/portal/Portal.php";

    $postdata="destination=".urlencode($destination)."&username=".urlencode($username)."&password=".urlencode($password)."&null=Login";

    $ch = curl_init();
    curl_setopt ($ch, CURLOPT_URL,"https://publisher.yahoo.com/portal/login.php");
    curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
    curl_setopt ($ch, CURLOPT_TIMEOUT, 20);
    curl_setopt ($ch, CURLOPT_FOLLOWLOCATION,1);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie);
    curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookie);
    curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
    curl_setopt ($ch, CURLOPT_POST, 1);
    $result = curl_exec ($ch);
    curl_close($ch);

    $lines = preg_split("/\r?\n|\r/", $result);

    foreach($lines as $val){
    eregi("<div><h3 class=\"ypnTotal\">(.*)</h3></div>", $val, $amount);
    $a1 = $amount[1];
    }

    mail("2065553944@yourcarrier.com", "YPN Report", $a1, "From: YPN");
    ?>
     
    phelixx, Jul 6, 2006 IP