Changeset 1319785
- Timestamp:
- 01/02/2016 06:07:23 AM (10 years ago)
- File:
-
- 1 edited
-
thunder-port/trunk/simple_html_dom.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
thunder-port/trunk/simple_html_dom.php
r1319784 r1319785 70 70 // get html dom from file 71 71 // $maxlen is defined in the code as PHP_STREAM_COPY_ALL which is defined as -1. 72 function file_get_contents_curl($url) { 73 $ch = curl_init(); 74 75 curl_setopt($ch, CURLOPT_HEADER, 0); 76 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser. 77 curl_setopt($ch, CURLOPT_URL, $url); 78 79 $data = curl_exec($ch); 80 curl_close($ch); 81 82 return $data; 83 } 84 72 85 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) 73 86 { … … 75 88 $dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText); 76 89 // For sourceforge users: uncomment the next line and comment the retreive_url_contents line 2 lines down if it is not already done. 77 $contents = file_get_contents($url, $use_include_path, $context, $offset); 90 // $contents = file_get_contents($url, $use_include_path, $context, $offset); 91 $contents = file_get_contents_curl($url); 78 92 // $contents = wp_remote_get($url); 79 93 // $contents = wp_remote_retrieve_body( $contents );
Note: See TracChangeset
for help on using the changeset viewer.