Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.99 KB | None | 0 0
  1. function file_get_html($url, $use_include_path = false, $context=null, $offset = -1, $maxLen=-1, $lowercase = true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
  2. {
  3.     // We DO force the tags to be terminated.
  4.     $dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText);
  5.     // For sourceforge users: uncomment the next line and comment the retreive_url_contents line 2 lines down if it is not already done.
  6.     $contents = file_get_contents($url, $use_include_path, $context, $offset);
  7.     // Paperg - use our own mechanism for getting the contents as we want to control the timeout.
  8.     //$contents = retrieve_url_contents($url);
  9.     if (empty($contents) || strlen($contents) > MAX_FILE_SIZE)
  10.     {
  11.         return false;
  12.     }
  13.     // The second parameter can force the selectors to all be lowercase.
  14.     $dom->load($contents, $lowercase, $stripRN);
  15.     return $dom;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement