Advertising
- Perl Interface to Curl C API
- Friday, August 10th, 2007 at 6:59:20am MDT
- #*****************************************************************************
- #* _ _ ____ _
- #* Project ___| | | | _ \| |
- #* / __| | | | |_) | |
- #* | (__| |_| | _ <| |___
- #* \___|\___/|_| \_\_____|
- #*
- #* $Id: perl_interface.pl,v 1.0 2007/08/10 13:45:11 Voldor Exp $
- #*****************************************************************************
- #!/usr/bin/perl -w
- #perl -MInline=Force,NoClean,Info perl_interface.pl // Debugging
- #perl perl_interface.pl // Run it
- #pp -M FindBin -M Inline -o perl_interface.pl perl_interface =>
- #Compile stand-alone exe, remember _Inline dir - not use comments or ___EOF___
- use Inline C => Config =>
- ENABLE => AUTOWRAP => #Use curl functions
- AUTO_INCLUDE => '#include "curl/curl.h"' => #Curl library
- LIBS => "-lcurl"; #Curl flag
- use Inline C => <<'END';
- char* curl_inline(char* host) {
- CURL *curl;
- CURLcode res;
- curl = curl_easy_init();
- curl_easy_setopt(curl, CURLOPT_URL, host);
- curl_easy_setopt(curl, CURLOPT_HEADER, 1);
- curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
- curl_easy_setopt(curl, CURLOPT_AUTOREFERER, 1);
- curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
- res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
- }
- END
- if (@ARGV < 1) {
- }
- curl_inline($host); #Run c code
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.