Advertisement
austinh115

[PHP] Horoscope 2

Oct 22nd, 2015
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.86 KB | None | 0 0
  1. <?php
  2. $signs = array("aries" => 1, "taurus" => 2, "gemini" => 3, "cancer" => 4, "leo" => 5, "virgo" => 6, "libra" => 7, "scorpio" => 8, "sagittarius" => 9, "capricorn" => 10, "aquarius" => 11, "pisces" => 12);
  3. $percent = array(1 => "20%", 2 => "40%", 3 => "60%", 4 => "80%", 5 => "100%");
  4. $sign = "aries";
  5. $page = file_get_contents("http://www.horoscope.com/us/horoscopes/general/horoscope-general-daily-today.aspx?sign=".$signs[$sign]);
  6. $horo = trim(explode('</div>', explode('<div class="block-horoscope-text f16 l20">', $page)[1])[0]);
  7. $chances = explode('</div>', explode('      </div>', explode('<div class="block-daily-facts-ratings-div">', $page)[1])[0], 4);
  8. foreach($chances as $i=>$chance) $chances[$i] = explode('</b>', explode("<b>", $chance)[1])[0]." ".$percent[explode('.png', explode('starrating_', $chance)[1])[0]];
  9. print $horo."\n".implode(" | " , $chances);
  10. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement