Advertisement
Guest User

Untitled

a guest
Jul 16th, 2016
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.75 KB | None | 0 0
  1.  
  2. program test6;
  3.  
  4. uses
  5.   Classes, LibCurl, UnixType;
  6.  
  7. Var
  8.   URL : Pchar = 'http://fullcirclemagazine.org/author/ronnie-2/feed/';
  9.   hCurl : pCurl;
  10.   f : TFileStream;
  11.  
  12.  
  13. Function DoWrite(Ptr : Pointer; Size : size_t; nmemb: size_t; Data : Pointer) : size_t; cdecl;
  14. begin
  15.   DoWrite := TStream(Data).Write(Ptr^,Size*nmemb);
  16. end;
  17.  
  18. begin
  19.   f:=TFileStream.Create('fcm.xml',fmCreate);
  20.  
  21.   hCurl:= curl_easy_init;
  22.   if Assigned(hCurl) then
  23.   begin
  24.     curl_easy_setopt(hCurl,CURLOPT_VERBOSE, [True]);
  25.     curl_easy_setopt(hCurl,CURLOPT_URL,[URL]);
  26.  
  27.     curl_easy_setopt(hCurl,CURLOPT_WRITEFUNCTION,[@DoWrite]);
  28.     curl_easy_setopt(hCurl,CURLOPT_WRITEDATA,[Pointer(f)]);
  29.  
  30.     curl_easy_perform(hCurl);
  31.     curl_easy_cleanup(hCurl);
  32.   end;
  33.  
  34.   f.Free;
  35. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement