Skip to content

Commit

Permalink
initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
juergen committed Aug 11, 2007
1 parent 151e71c commit 5cda471
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions examples/ebaylogin.lua
@@ -0,0 +1,37 @@
-- try eBay login
require("cURL")

headers = {"Accept: text/*",
"Accept-Language: en",
"Accept-Charset: iso-8859-1,*,utf-8",
"Cache-Control: no-cache"}
login1_url = "https://signin.ebay.com/ws/eBayISAPI.dll?SignIn"
login2_url = "https://signin.ebay.com/ws/eBayISAPI.dll?SignInWelcome&userid=%s&pass=%s&keepMeSignInOption=1"

c = cURL.easy_init()
c:setopt_useragent("Mozilla/5.0 (Windows; U; Windows NT 5.0; de; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6")
c:setopt_httpheader(headers)
c:setopt_cookiefile("")
c:setopt_followlocation(1)


c:setopt_url(login1_url)
-- ignore output, just set cookie
c:perform({writefunction = function (str) end})

print("Username:")
username=io.read()
print("Password:")
password=io.read()

c:setopt_url(string.format(login2_url, c:escape(username), c:escape(password)))
c:perform({writefunction=function(str)
succeed = succeed or (string.find(str, "srcId:%s+SignInAlertSupressor--"))
end })

if (succeed) then
print("Login succeed")
else
print("Login failed")
end

0 comments on commit 5cda471

Please sign in to comment.