Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Curl support #25

Closed
GoogleCodeExporter opened this issue May 7, 2015 · 2 comments
Closed

Curl support #25

GoogleCodeExporter opened this issue May 7, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

It is not exactly an issue, but i'd like to use this beautiful parser with 
curl. How can I use this function with your class?

function get_web_page( $url )
{
    $options = array(
        CURLOPT_RETURNTRANSFER => true,     // return web page
        CURLOPT_HEADER         => false,    // don't return headers
        CURLOPT_FOLLOWLOCATION => true,     // follow redirects
        CURLOPT_ENCODING       => "",       // handle compressed
        CURLOPT_USERAGENT      => "spider", // who am i
        CURLOPT_AUTOREFERER    => true,     // set referer on redirect
        CURLOPT_CONNECTTIMEOUT => 120,      // timeout on connect
        CURLOPT_TIMEOUT        => 120,      // timeout on response
        CURLOPT_MAXREDIRS      => 10,       // stop after 10 redirects
    );

    $ch      = curl_init( $url );
    curl_setopt_array( $ch, $options );
    $content = curl_exec( $ch );
    $err     = curl_errno( $ch );
    $errmsg  = curl_error( $ch );
    $header  = curl_getinfo( $ch );
    curl_close( $ch );

    $header['errno']   = $err;
    $header['errmsg']  = $errmsg;
    $header['content'] = $content;
    return $header;
}

Original issue reported on code.google.com by bey...@gmail.com on 24 Oct 2012 at 10:34

@GoogleCodeExporter
Copy link
Author

you could just export the curl output to a .log file and then feed it to ganon 
in order to handle that data... that's what I did...

Original comment by Carlos.g...@gmail.com on 10 Nov 2012 at 3:12

@GoogleCodeExporter
Copy link
Author

Yes, you can save it to a string/file and feed it to 
str_get_dom()/file_get_dom().

Original comment by niels....@gmail.com on 11 Nov 2012 at 6:32

  • Changed state: WontFix
  • Added labels: Priority-Low, Type-Review
  • Removed labels: Priority-Medium, Type-Defect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant