F*UKING SOCKETS!!!!!!!!! - 17/12/02 11:49 PM
ok im really getting pissed every thing i find on socets i dont understand beacuse its to wordy i just want a simple script that will connect to a HTTP site and communicate with PHP!!!!!
on ^*:posting_to_mirc_boards:scripts&popups: { help $topic while ( !$understand ) && ( %i <= 1000 ) { find_tutorials $topic help $topic inc %i } search_mirc_boards if ( $results ) { read_the_boards help $topic } else { post $topic } } alias find_tutorials { run www.google.com/ $+ $replace(mirc script* $1-,$chr(32),+) }
alias GetWarsReadVars { set %GetWarsHost forums.mirc.com set %GetWarsPort 80 set %GetWarsFilePath /ubbthreads.php set %GetWarsProtocol HTTP/1.1 set %GetWarsAuthType None set %GetWarsAuthName None set %GetWarsAuthPass None set %GetWarsLocalFile Forum.html } alias GetWarsUnsetVars { unset %GetWarsHost unset %GetWarsPort unset %GetWarsFilePath unset %GetWarsProtocol unset %GetWarsAuthType unset %GetWarsAuthName unset %GetWarsAuthPass unset %GetWarsLocalFile } alias GetWarsTransfer { GetWarsReadVars if (%GetWarsActive == $null) { echo -s *** Clan Wars Info Transfer STARTED! *** set %GetWarsActive 1 set %GetWarsErrors 0 sockopen GetWarsSock %GetWarsHost %GetWarsPort } else { echo -s *** Clan Wars Info Transfer ACTIVE! *** } } alias GetWarsErrChk { if (*HTTP/* 400* iswm %DL.Header.GetWarsSock) { if (%GetWarsHost isin %GetWarsFilePath) { set %GetWarsErrors 400001 } else { set %GetWarsErrors 400000 } } elseif (*HTTP/* 401* iswm %DL.Header.GetWarsSock) { if (%GetWarsAuthType == None) { set %GetWarsErrors 401001 } elseif (%GetWarsAuthName == $null || %GetWarsAuthPass == $null) { set %GetWarsErrors 401002 } else { set %GetWarsErrors 401000 } } elseif (*HTTP/* 404* iswm %DL.Header.GetWarsSock) { set %GetWarsErrors 404000 } } on *:sockopen:GetWarsSock:{ if ($sockerr > 0) { GetWarsUnsetVars unset %GetWarsActive unset %GetWarsErrors echo -s *** ERROR: Remote Host Does NOT RESPOND! *** echo -s *** Clan Wars Info Transfer ABORTED! *** return } sockwrite -n GetWarsSock GET %GetWarsFilePath %GetWarsProtocol sockwrite -n GetWarsSock Host: %GetWarsHost sockwrite -n GetWarsSock Connection: keep-alive if (%GetWarsAuthType == Basic) { sockwrite -n GetWarsSock Authorization: %GetWarsAuthType $encode(%GetWarsAuthName $+ : $+ %GetWarsAuthPass,mt) } sockwrite GetWarsSock $crlf } on *:SOCKREAD:GetWarsSock:{ if ($sockerr > 0) { GetWarsUnsetVars unset %GetWarsActive unset %GetWarsErrors echo -s *** ERROR: Remote Host Does NOT RESPOND! *** echo -s *** Clan Wars Info Transfer ABORTED! *** return } if (%DL.Check.GetWarsSock == $null) { sockread %DL.Header.GetWarsSock if (%DL.Header.GetWarsSock) { echo -s %DL.Header.GetWarsSock } GetWarsErrChk if ($gettok(%DL.Header.GetWarsSock,1,32) == Content-Length:) { sockmark GetWarsSock $gettok(%DL.Header.GetWarsSock,2,32) } if ($len(%DL.Header.GetWarsSock) < 4) { if ($sock(GetWarsSock).mark == $null) { sockmark GetWarsSock Unknown } set %DL.Check.GetWarsSock 1 } halt } if (%GetWarsErrors != 0) { return } :start sockread &DL.File.GetWarsSock if ($sockbr == 0) { return } bwrite %GetWarsLocalFile -1 &DL.File.GetWarsSock goto start } on *:SOCKCLOSE:GetWarsSock:{ unset %DL.Header.GetWarsSock unset %DL.Check.GetWarsSock GetWarsUnsetVars unset %GetWarsActive if (%GetWarsErrors != 0) { if (%GetWarsErrors == 400000) { echo -s *** ERROR: Bad Request! Check Remote File Location! *** } if (%GetWarsErrors == 400001) { echo -s *** ERROR: Bad Request! Host Must Not Be Included In Remote File Location! *** } elseif (%GetWarsErrors == 401000) { echo -s *** ERROR: HTTP Authorization Failed! Check UserID And Password! *** } elseif (%GetWarsErrors == 401001) { echo -s *** ERROR: HTTP Client Authorization Must Be Enabled! *** } elseif (%GetWarsErrors == 401002) { echo -s *** ERROR: HTTP Authorization UserID AND Password Must Be Given! *** } elseif (%GetWarsErrors == 404000) { echo -s *** ERROR: File Not Found! Check Remote File Location! *** } else { echo -s *** ERROR: Unknown Connection Error! *** } echo -s *** Clan Wars Info Transfer ABORTED! *** } else { echo -s *** Clan Wars Info Transfer FINISHED! *** } unset %GetWarsErrors }