this form use Image Verification
need some code samples.
* bin is Binary file library , bit is Bitwise , obj is Object
run it , button2 click , it's works , I got a validcode image
but button1 click , I got error , The remote server returned an error (417) Expectation Failed
need some code samples.
* bin is Binary file library , bit is Bitwise , obj is Object
B4X:
Sub Globals
'Declare the global variables here.
Dim buffer(0) As Byte
End Sub
Sub App_Start
Form1.Show
End Sub
Sub Button1_Click
textbox1.Text="Post gogogo"
bit.New1
Request.New1("http://www.site.com/login")
Request.Method = "POST"
Request.ContentType = "application/x-www-form-urlencoded"
Request.Timeout = 30000
s="username=nsc&password=XXX&useCookie=1&signonForwardAction=&validcode=" & textbox2.Text
buffer() = bit.StringToBytes(s,0,StrLength(s))
Request.ContentLength=StrLength(s)
bin.New1(Request.GetStream,True)
bin.WriteBytes(buffer())
Response.New1
Response.Value = Request.GetResponse
textbox1.Text = Response.GetString
Response.Close
End Sub
Sub Button2_Click
Form1.Show
Request.New1("http://www.site.com/valid")
Response.New1
obj.New1(False)
args.New1(1)
Response.Value = Request.GetResponse
args.SetObject(0,Response.GetStream) '
obj.CreateNew2("System.Drawing.Bitmap" & obj.System_Drawing,args.Value)
image1.Image = obj.Value
End Sub
run it , button2 click , it's works , I got a validcode image
but button1 click , I got error , The remote server returned an error (417) Expectation Failed
Last edited: