Guest User

Untitled

a guest
Jan 20th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. function getMetas($link) {
  2. $str1 = file_get_contents($link);
  3.  
  4. if (strlen($str1)>0) {
  5.  
  6. preg_match( '/<meta.*?name=("|')description("|').*?content=("|')(.*?)("|')/i', $str1, $description);
  7.  
  8. if (count($description) > 1) {
  9. return $description[4];
  10. }
  11.  
  12. }
  13.  
  14. }
  15.  
  16.  
  17. function Titles($link) {
  18. $str = file_get_contents($link);
  19. if( strlen( $str )>0 ) {
  20.  
  21. preg_match( "/<title>(.*)</title>/", $str, $titles );
  22.  
  23. if (count($titles) > 1) {
  24. return $titles[1];
  25. }
  26. }
  27.  
  28. return '';
  29. }
  30.  
  31.  
  32. It doesn't return anything because no array or anything is specfified.
Add Comment
Please, Sign In to add comment