y0u tub3 View Increaser GUI

Redneck

Newbie
Joined
May 24, 2008
Messages
15
Reaction score
2
This is a simple y0u tub3 View Increaser with a GUI.
It was a quick little project I made to show everyone how to do it with FreePascal+Lazarus.

200807241428091680x1050ia1.png


You will need
Lazarus: h**p://www.lazarus.freepascal.org/index.php
FreePascal (FPC): h**p://www.freepascal.org/
and cUrl: h**p://curl.haxx.se/

I use Arch Linux, but this code should compile and run on any OS that you can install Lazarus, FPC and cUrl.

If you have had any experience with Delphi then Lazarus should be easy for you.

Make separate text files, all in the same folder, for each of the code blocks below.
The name for each of the files will be right above the code block.

Run Lazarus. Open the ".lpi" file in Lazarus.
On Lazarus menu click Run and then Run on the submenu.

File name: tubeincreasegui.lpi
Code:
<?xml version="1.0"?>
<CONFIG>
  <ProjectOptions>
    <PathDelim Value="/"/>
    <Version Value="6"/>
    <General>
      <MainUnit Value="0"/>
      <TargetFileExt Value=""/>
      <ActiveEditorIndexAtStart Value="0"/>
    </General>
    <VersionInfo>
      <ProjectVersion Value=""/>
      <Language Value=""/>
      <CharSet Value=""/>
    </VersionInfo>
    <PublishOptions>
      <Version Value="2"/>
      <IgnoreBinaries Value="False"/>
      <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
      <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
    </PublishOptions>
    <RunParams>
      <local>
        <FormatVersion Value="1"/>
        <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
      </local>
    </RunParams>
    <RequiredPackages Count="1">
      <Item1>
        <PackageName Value="LCL"/>
      </Item1>
    </RequiredPackages>
    <Units Count="3">
      <Unit0>
        <Filename Value="tubeincreasegui.lpr"/>
        <IsPartOfProject Value="True"/>
        <UnitName Value="tubeincreasegui"/>
        <UsageCount Value="20"/>
      </Unit0>
      <Unit1>
        <Filename Value="unit1.pas"/>
        <ComponentName Value="Form1"/>
        <IsPartOfProject Value="True"/>
        <ResourceFilename Value="unit1.lrs"/>
        <UnitName Value="Unit1"/>
        <CursorPos X="57" Y="130"/>
        <TopLine Value="94"/>
        <EditorIndex Value="0"/>
        <UsageCount Value="20"/>
        <Loaded Value="True"/>
      </Unit1>
      <Unit2>
        <Filename Value="usecurl.pas"/>
        <IsPartOfProject Value="True"/>
        <UnitName Value="usecurl"/>
        <CursorPos X="39" Y="8"/>
        <TopLine Value="1"/>
        <EditorIndex Value="1"/>
        <UsageCount Value="20"/>
        <Loaded Value="True"/>
      </Unit2>
    </Units>
    <JumpHistory Count="22" HistoryIndex="21">
      <Position1>
        <Filename Value="unit1.pas"/>
        <Caret Line="24" Column="16" TopLine="1"/>
      </Position1>
      <Position2>
        <Filename Value="unit1.pas"/>
        <Caret Line="14" Column="3" TopLine="1"/>
      </Position2>
      <Position3>
        <Filename Value="unit1.pas"/>
        <Caret Line="17" Column="32" TopLine="1"/>
      </Position3>
      <Position4>
        <Filename Value="unit1.pas"/>
        <Caret Line="16" Column="22" TopLine="1"/>
      </Position4>
      <Position5>
        <Filename Value="unit1.pas"/>
        <Caret Line="19" Column="28" TopLine="1"/>
      </Position5>
      <Position6>
        <Filename Value="unit1.pas"/>
        <Caret Line="18" Column="20" TopLine="1"/>
      </Position6>
      <Position7>
        <Filename Value="unit1.pas"/>
        <Caret Line="19" Column="20" TopLine="1"/>
      </Position7>
      <Position8>
        <Filename Value="unit1.pas"/>
        <Caret Line="24" Column="43" TopLine="1"/>
      </Position8>
      <Position9>
        <Filename Value="unit1.pas"/>
        <Caret Line="9" Column="21" TopLine="1"/>
      </Position9>
      <Position10>
        <Filename Value="usecurl.pas"/>
        <Caret Line="1" Column="6" TopLine="1"/>
      </Position10>
      <Position11>
        <Filename Value="unit1.pas"/>
        <Caret Line="25" Column="5" TopLine="9"/>
      </Position11>
      <Position12>
        <Filename Value="unit1.pas"/>
        <Caret Line="82" Column="1" TopLine="54"/>
      </Position12>
      <Position13>
        <Filename Value="unit1.pas"/>
        <Caret Line="72" Column="25" TopLine="32"/>
      </Position13>
      <Position14>
        <Filename Value="unit1.pas"/>
        <Caret Line="30" Column="15" TopLine="87"/>
      </Position14>
      <Position15>
        <Filename Value="unit1.pas"/>
        <Caret Line="68" Column="24" TopLine="40"/>
      </Position15>
      <Position16>
        <Filename Value="unit1.pas"/>
        <Caret Line="26" Column="45" TopLine="25"/>
      </Position16>
      <Position17>
        <Filename Value="unit1.pas"/>
        <Caret Line="128" Column="35" TopLine="84"/>
      </Position17>
      <Position18>
        <Filename Value="unit1.pas"/>
        <Caret Line="130" Column="79" TopLine="86"/>
      </Position18>
      <Position19>
        <Filename Value="unit1.pas"/>
        <Caret Line="29" Column="14" TopLine="22"/>
      </Position19>
      <Position20>
        <Filename Value="unit1.pas"/>
        <Caret Line="124" Column="21" TopLine="103"/>
      </Position20>
      <Position21>
        <Filename Value="unit1.pas"/>
        <Caret Line="128" Column="34" TopLine="102"/>
      </Position21>
      <Position22>
        <Filename Value="unit1.pas"/>
        <Caret Line="146" Column="101" TopLine="104"/>
      </Position22>
    </JumpHistory>
  </ProjectOptions>
  <CompilerOptions>
    <Version Value="5"/>
    <CodeGeneration>
      <Generate Value="Faster"/>
    </CodeGeneration>
    <Linking>
      <Options>
        <Win32>
          <GraphicApplication Value="True"/>
        </Win32>
      </Options>
    </Linking>
    <Other>
      <CompilerPath Value="$(CompPath)"/>
    </Other>
  </CompilerOptions>
  <Debugging>
    <Exceptions Count="2">
      <Item1>
        <Name Value="ECodetoolError"/>
      </Item1>
      <Item2>
        <Name Value="EFOpenError"/>
      </Item2>
    </Exceptions>
  </Debugging>
</CONFIG>

File name: tubeincreasegui.lpr
Code:
{
Tube Increase Gui
Made by: Redneck
For: BlackHatWorld.com
}
program tubeincreasegui;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Interfaces, // this includes the LCL widgetset
  Forms
  { you can add units after this }, Unit1, usecurl;

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

File name: unit1.lfm
Code:
object Form1: TForm1
  Left = 328
  Height = 177
  Top = 309
  Width = 400
  HorzScrollBar.Page = 399
  VertScrollBar.Page = 176
  ActiveControl = ComboBox1
  BorderIcons = [biMinimize]
  BorderStyle = bsSingle
  Caption = 'Tube Increase GUI'
  ClientHeight = 177
  ClientWidth = 400
  OnCreate = FormCreate
  Position = poScreenCenter
  object Label1: TLabel
    Left = 5
    Height = 17
    Top = 96
    Width = 62
    Caption = 'Views: ?'
    ParentColor = False
  end
  object Label2: TLabel
    Left = 144
    Height = 17
    Top = 96
    Width = 99
    Alignment = taCenter
    Caption = 'Comments: ?'
    ParentColor = False
  end
  object Label3: TLabel
    Left = 293
    Height = 17
    Top = 96
    Width = 100
    Alignment = taRightJustify
    Caption = 'Responses: ?'
    ParentColor = False
  end
  object Label4: TLabel
    Left = 347
    Height = 17
    Top = 74
    Width = 46
    Alignment = taRightJustify
    Caption = '10000'
    ParentColor = False
  end
  object ComboBox1: TComboBox
    Left = 5
    Height = 23
    Top = 7
    Width = 388
    AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
    MaxLength = 65535
    TabOrder = 0
    Text = 'Put URL here'
  end
  object TrackBar1: TTrackBar
    Left = 5
    Height = 33
    Top = 35
    Width = 388
    Max = 10000
    Min = 1
    Position = 100
    ScalePos = trTop
    TabOrder = 1
  end
  object ProgressBar1: TProgressBar
    Left = 5
    Height = 17
    Top = 74
    Width = 339
    Max = 100
    Smooth = True
    Step = 1
  end
  object Button1: TButton
    Left = 204
    Height = 26
    Top = 120
    Width = 189
    Caption = 'Start'
    OnClick = Button1Click
    TabOrder = 2
  end
  object StatusBar1: TStatusBar
    Height = 24
    Top = 153
    Width = 400
    Panels = <>
  end
  object Button2: TButton
    Left = 5
    Height = 26
    Top = 120
    Width = 189
    Caption = 'Stop'
    OnClick = Button2Click
    TabOrder = 3
  end
end

File name: unit1.pas
Code:
{
Tube Increase Gui
Made by: Redneck
For: BlackHatWorld.com
}
unit Unit1; 

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
  ComCtrls, usecurl;

type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    ComboBox1: TComboBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    ProgressBar1: TProgressBar;
    StatusBar1: TStatusBar;
    TrackBar1: TTrackBar;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure StartTheBotUp;
    function GetTheVidFile: boolean;
    function GetTheVideoID(Linput: string): string;
    function GetTheTstring(Linput: string): string;
    procedure GetTheVidTandID;
    procedure GetTheVidInfo;
    function GetTheVidCountstring(Linput: string): string;
    function GetTheVidTextCommentCountstring(Linput: string): string;
    function GetTheVidResponseCountstring(Linput: string): string;
    procedure FormObjectsAble(denable: boolean);
    procedure AddThisUrl(urltoadd: string);
  private
    { private declarations }
    MyCurls:  AbuseCurl;
  public
    { public declarations }
    wrkfoldr: string;
    cookkeefile: string;
    utubeurl: string;
    canwerun: boolean;
    alladded: integer;
    myvidid: string;
    mytstring: string;
    badget: integer;
  end;

const
  appdirname: string = 'tubeincreasegui';
  version: string = '0.0.1';

var
  Form1: TForm1; 

implementation

{ TForm1 }

procedure TForm1.FormCreate(Sender: TObject);
begin
  wrkfoldr := Trim(GetEnvironmentVariable('HOME'));
  wrkfoldr := wrkfoldr + '/.' + appdirname;
  if DirectoryExists(wrkfoldr) = False then CreateDir(wrkfoldr);
  cookkeefile := wrkfoldr + '/cookies.txt';
  if FileExists(cookkeefile) then DeleteFile(cookkeefile);
  if FileExists(wrkfoldr + '/usedurls.txt') then ComboBox1.Items.LoadFromFile(wrkfoldr + '/usedurls.txt');
  StatusBar1.SimpleText := 'Tube Increase GUI Bot v' + version;
  Button2.Enabled := False;
  Label4.Caption := '0';
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  utubeurl := Trim(ComboBox1.Text);
  if (utubeurl <> '') and not (utubeurl = 'Put URL here') then
  begin
    StartTheBotUp;
  end
  else
  begin
    StatusBar1.SimpleText := 'You need a Url!';
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  canwerun := False;
  Button2.Enabled := False;
end;

procedure TForm1.StartTheBotUp;
begin
  StatusBar1.SimpleText := 'Starting';
  FormObjectsAble(False);
  ProgressBar1.Min := 0;
  ProgressBar1.Position := 0;
  ProgressBar1.Max := TrackBar1.Position;
  Label4.Caption := inttostr(ProgressBar1.Position);
  canwerun := True;
  AddThisUrl(utubeurl);
  Application.ProcessMessages;
  badget := 0;
  StatusBar1.SimpleText := 'Getting info...';
  if (canwerun = True) then GetTheVidInfo;
  StatusBar1.SimpleText := 'Starting the viewer...';
  Application.ProcessMessages;
  alladded := 1;
  repeat
    StatusBar1.SimpleText := 'Download #' + inttostr(alladded) + ' get Tstring and VidID';
    Application.ProcessMessages;
    if FileExists(cookkeefile) then DeleteFile(cookkeefile);
    if (canwerun = True) then GetTheVidTandID;
    if (myvidid <> '') and (mytstring <> '') and (canwerun = True) then
    begin
      StatusBar1.SimpleText := 'Download #' + inttostr(alladded) + ' getting video now';
      Application.ProcessMessages;
      if (GetTheVidFile = True) then
        StatusBar1.SimpleText := 'Download #' + inttostr(alladded) + ' SUCCESS!'
      else
        StatusBar1.SimpleText := 'Download #' + inttostr(alladded) + ' FAILED!';
      Inc(alladded);
      ProgressBar1.Position := ProgressBar1.Position + 1;
      Label4.Caption := inttostr(ProgressBar1.Position);
    end
    else
    begin
      StatusBar1.SimpleText := 'Download #' + inttostr(alladded) + ' Tstring and VidID: FAILED!';
      Inc(badget);
      Application.ProcessMessages;
    end;
  until(alladded = TrackBar1.Position + 1) or (canwerun = False) or (badget > 10);
  if FileExists(cookkeefile) then DeleteFile(cookkeefile);
  if (badget > 10) then
  begin
    StatusBar1.SimpleText := 'Stopped. Good: ' + inttostr(alladded-1) + ' Bad: ' + inttostr(badget);
  end
  else if (canwerun = False) then
  begin
    StatusBar1.SimpleText := 'User Stopped. Good: ' + inttostr(alladded-1) + ' Bad: ' + inttostr(badget);
  end
  else
  begin
    StatusBar1.SimpleText := 'Finished! Good: ' + inttostr(alladded-1) + ' Bad: ' + inttostr(badget);
  end;
  FormObjectsAble(True);
end;

function TForm1.GetTheVidFile: boolean;
var
  durle, refferr, dgetetback, dlfile: string;
begin
  durle := 'http://www.youtube.com/get_video?video_id=' + myvidid + '&t=' + mytstring + '&eurl=';
  refferr := utubeurl;
  dlfile := wrkfoldr + '/0fille.mp4';
  dgetetback := MyCurls.DoTheCurl(durle, wrkfoldr, cookkeefile, refferr, '', '0', '', dlfile, True, 30);
  if FileExists(dlfile) then
  begin
    DeleteFile(dlfile);
    result := True;
  end
  else
  begin
    result := False;
  end;
end;

function TForm1.GetTheVideoID(Linput: string): string;
var
  turetrun: string;
begin
   Linput := StringReplace(Linput, '"', '', [rfReplaceAll, rfIgnoreCase]);
   Linput := StringReplace(Linput, '''', '', [rfReplaceAll, rfIgnoreCase]);
   Linput := StringReplace(Linput, 'video_id: ', 'DEJSUSER=', [rfReplaceAll]);
   turetrun := Copy(Linput, pos('DEJSUSER=', Linput) + 9, Length(Linput));
   turetrun := Copy(turetrun, 1, pos(',', turetrun) - 1);
   result := turetrun;
end;

function TForm1.GetTheTstring(Linput: string): string;
var
  turetrun: string;
begin
   Linput := StringReplace(Linput, '"', '', [rfReplaceAll, rfIgnoreCase]);
   Linput := StringReplace(Linput, '''', '', [rfReplaceAll, rfIgnoreCase]);
   Linput := StringReplace(Linput, ', t: ', 'DEJSUSER=', [rfReplaceAll]);
   turetrun := Copy(Linput, pos('DEJSUSER=', Linput) + 9, Length(Linput));
   turetrun := Copy(turetrun, 1, pos(',', turetrun) - 1);
   result := turetrun;
end;

procedure TForm1.GetTheVidTandID;
var
  durle, refferr, dgetetback: string;
begin
  durle := utubeurl;
  refferr := 'http://www.google.com/search?hl=en&pwst=1&q=youtube+video&start=10&sa=N';
  dgetetback := MyCurls.DoTheCurl(durle, wrkfoldr, cookkeefile, refferr, '', '0', '', '', True, 30);
  if (pos('var swfArgs = {', dgetetback) <> 0) then
  begin
    myvidid := GetTheVideoID(dgetetback);
    mytstring := GetTheTstring(dgetetback);
  end
  else
  begin
    myvidid := '';
    mytstring := '';
  end;
end;

procedure TForm1.GetTheVidInfo;
var
  durle, refferr, dgetetback: string;
begin
  durle := utubeurl;
  refferr := 'http://www.google.com/search?hl=en&pwst=1&q=youtube+video&start=10&sa=N';
  dgetetback := MyCurls.DoTheCurl(durle, wrkfoldr, cookkeefile, refferr, '', '0', '', '', True, 30);
  if (pos('var swfArgs = {', dgetetback) <> 0) then
  begin
    Label1.Caption := 'Views: ' + GetTheVidCountstring(dgetetback);
    Label2.Caption := 'Comments: ' + GetTheVidTextCommentCountstring(dgetetback);
    Label3.Caption := 'Responses: ' + GetTheVidResponseCountstring(dgetetback);
  end
  else
  begin
    canwerun := False;
    StatusBar1.SimpleText := 'Cannot get info. Quitting!';
  end;
end;

function TForm1.GetTheVidCountstring(Linput: string): string;
var
  turetrun: string;
begin
   Linput := StringReplace(Linput, '"', '', [rfReplaceAll, rfIgnoreCase]);
   Linput := StringReplace(Linput, '''', '', [rfReplaceAll, rfIgnoreCase]);
   Linput := StringReplace(Linput, '<span id=watch-view-count>', 'DEJSUSER=', [rfReplaceAll]);
   turetrun := Copy(Linput, pos('DEJSUSER=', Linput) + 9, Length(Linput));
   turetrun := Copy(turetrun, 1, pos('<', turetrun) - 1);
   result := turetrun;
end;

function TForm1.GetTheVidTextCommentCountstring(Linput: string): string;
var
  turetrun: string;
begin
   Linput := StringReplace(Linput, '"', '', [rfReplaceAll, rfIgnoreCase]);
   Linput := StringReplace(Linput, '''', '', [rfReplaceAll, rfIgnoreCase]);
   Linput := StringReplace(Linput, 'Text Comments: <span>', 'DEJSUSER=', [rfReplaceAll]);
   turetrun := Copy(Linput, pos('DEJSUSER=', Linput) + 9, Length(Linput));
   turetrun := Copy(turetrun, 1, pos('<', turetrun) - 1);
   result := turetrun;
end;

function TForm1.GetTheVidResponseCountstring(Linput: string): string;
var
  turetrun: string;
begin
   Linput := StringReplace(Linput, '"', '', [rfReplaceAll, rfIgnoreCase]);
   Linput := StringReplace(Linput, '''', '', [rfReplaceAll, rfIgnoreCase]);
   Linput := StringReplace(Linput, '<span id=watch-comments-numresponses>', 'DEJSUSER=', [rfReplaceAll]);
   turetrun := Copy(Linput, pos('DEJSUSER=', Linput) + 9, Length(Linput));
   turetrun := Copy(turetrun, 1, pos('<', turetrun) - 1);
   result := turetrun;
end;

procedure TForm1.FormObjectsAble(denable: boolean);
begin
  Button1.Enabled := denable;
  ComboBox1.Enabled := denable;
  TrackBar1.Enabled := denable;
  if (denable = True) then
    Button2.Enabled := False
  else
    Button2.Enabled := True;
end;

procedure TForm1.AddThisUrl(urltoadd: string);
begin
  if (ComboBox1.Items.IndexOf(urltoadd) = (-1)) then
  begin
    ComboBox1.Items.Add(urltoadd);
    ComboBox1.Items.SaveToFile(wrkfoldr + '/usedurls.txt');
  end;
end;

initialization
  {$I unit1.lrs}

end.

File name: usecurl.pas
Code:
{
Tube Increase Gui
Made by: Redneck
For: BlackHatWorld.com
}
unit usecurl;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, libcurl, unixtype;

type
  AbuseCurl = class
  private
    { private declarations }
  public
    function DoTheCurl(URL, workfldr, cookyfile, repherer, postvarstr, proxytype, proxieport, fillename: string; autoreph: boolean; timmeout: integer) : string;
  end;

implementation

function DoWrite(Ptr : Pointer; Size : size_t; nmemb: size_t; Data : Pointer) : size_t;cdecl;
begin
  Result:=TStream(Data).Write(Ptr^,Size*nmemb);
end;

function AbuseCurl.DoTheCurl(URL, workfldr, cookyfile, repherer, postvarstr, proxytype, proxieport, fillename: string; autoreph: boolean; timmeout: integer) : string;
var
  F : TFileStream;
  hCurl : pCurl;
  tmplist: TStringList;
  i: integer;
  allfile, savedfilename: string;
  K: Text;
  header : Pcurl_slist = Nil;
begin
  if (fillename = '') then
    savedfilename := workfldr + '/usecurl.html.tmp'
  else
    savedfilename := fillename;

  F := TFileStream.Create(savedfilename, fmCreate);
  try
    hCurl:= curl_easy_init;
    if Assigned(hCurl) then
      begin
      header := curl_slist_append(header, 'Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5');
      header := curl_slist_append(header, 'Accept-Language: en-us,en;q=0.5');
      header := curl_slist_append(header, 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7');
      header := curl_slist_append(header, 'Keep-Alive: 300');
      header := curl_slist_append(header, 'Connection: Close');

      if (repherer <> '') then
        curl_easy_setopt(hCurl, CURLOPT_REFERER, [PChar(repherer)]);

//      curl_easy_setopt(hCurl, CURLOPT_VERBOSE, [True]);
      curl_easy_setopt(hCurl, CURLOPT_URL,[PChar(URL)]);
  if not (proxytype = '0') then
  begin
      curl_easy_setopt(hCurl, CURLOPT_PROXY,[PChar(proxieport)]);
  if (proxytype = '4') then
      curl_easy_setopt(hCurl, CURLOPT_PROXYTYPE, [CURLPROXY_SOCKS4]);
  if (proxytype = '5') then
      curl_easy_setopt(hCurl, CURLOPT_PROXYTYPE, [CURLPROXY_SOCKS5]);
  if (proxytype = '2') then
      curl_easy_setopt(hCurl, CURLOPT_PROXYTYPE,[CURLPROXY_HTTP]);
  end;
      curl_easy_setopt(hCurl, CURLOPT_CONNECTTIMEOUT,[timmeout]);
      curl_easy_setopt(hCurl, CURLOPT_TIMEOUT,[timmeout]);
      curl_easy_setopt(hCurl, CURLOPT_SSL_VERIFYPEER, [FALSE]);
      curl_easy_setopt(hCurl, CURLOPT_NOSIGNAL,[1]);
      curl_easy_setopt(hCurl, CURLOPT_HTTPHEADER, [header]);
      if (autoreph = True) then
      curl_easy_setopt(hCurl, CURLOPT_AUTOREFERER,[1]);
      curl_easy_setopt(hCurl, CURLOPT_FOLLOWLOCATION,[1]);
      curl_easy_setopt(hCurl, CURLOPT_ENCODING, [PChar('')]);
      curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION,[@DoWrite]);
      curl_easy_setopt(hCurl, CURLOPT_WRITEDATA,[Pointer(F)]);
      curl_easy_setopt(hCurl, CURLOPT_USERAGENT, [PChar('User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11')]);
      curl_easy_setopt(hCurl, CURLOPT_COOKIEFILE, [PChar(cookyfile)]);
      curl_easy_setopt(hCurl, CURLOPT_COOKIEJAR, [PChar(cookyfile)]);
      if not (postvarstr = '') then
      begin
        curl_easy_setopt(hCurl, CURLOPT_POST, [1]);
        curl_easy_setopt(hCurl, CURLOPT_POSTFIELDS,[PChar(postvarstr)]);
      end;
      curl_easy_perform(hCurl);
      curl_easy_cleanup(hCurl);
      end;
  finally
    F.Free;
    if (fillename = '') then
    begin
      tmplist := TStringList.Create;
      allfile := '';
      tmplist.LoadFromFile(savedfilename);
      for i := 0 to tmplist.Count - 1 do
        allfile := allfile + tmplist[i];

      Assign (K, savedfilename);
      Erase(K);
      FreeAndNil(tmplist);
      result := allfile;
    end
    else
    begin
      result := fillename;
    end;
  end;
end;

end.
 
Back
Top