Plugin Directory

Changeset 1319785


Ignore:
Timestamp:
01/02/2016 06:07:23 AM (10 years ago)
Author:
vividlteam
Message:

fix bug

File:
1 edited

Legend:

Unmodified
Added
Removed
  • thunder-port/trunk/simple_html_dom.php

    r1319784 r1319785  
    7070// get html dom from file
    7171// $maxlen is defined in the code as PHP_STREAM_COPY_ALL which is defined as -1.
     72function 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
    7285function 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)
    7386{
     
    7588    $dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText);
    7689    // 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);
    7892    // $contents = wp_remote_get($url);
    7993    // $contents = wp_remote_retrieve_body( $contents );
Note: See TracChangeset for help on using the changeset viewer.