Advertisement
austinh115

[PHP] Horoscope v3.5 (nice versioning, me)

Feb 24th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.01 KB | None | 0 0
  1. <?php
  2. $signs = [null, "aries", "taurus", "gemini", "cancer", "leo", "virgo", "libra", "scorpio", "sagittarius", "capricorn", "aquarius", "pisces"];
  3. $sign = array_search(strtolower("gemini"), $signs);
  4. if(!$sign) die("bad thing");
  5. /*///////////////////////////////////
  6.  
  7. just copy the stuff below here b4 the print idk
  8. u know what 2 do
  9.  
  10. ///////////////////////////////////*/
  11. $percent = array(1 => "20%", 2 => "40%", 3 => "60%", 4 => "80%", 5 => "100%");
  12. $page = file_get_contents("http://www.horoscope.com/us/horoscopes/general/horoscope-general-daily-today.aspx?sign=".$sign);
  13. $horo = trim(explode('<br><br>', explode('</b> - ', $page)[1])[0]);
  14. $chances = explode('text-right">', explode('<div class="row non-mobile">', explode('ratings">', $page)[1])[0]);
  15. array_shift($chances);
  16. foreach($chances as $i=>$chance) $chances[$i] = explode('</h4>', explode("<h4>", $chance)[1])[0]." ".$percent[explode('-stars', explode('ratings/', $chance)[1])[0]];
  17. //
  18.  
  19. //
  20. print $horo."\n";
  21. print implode(" | " , $chances)."\n";
  22.  
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement