ถ้าเว็บพวกนี้ไม่มี API มาให้ใช้ ก็น่าจะทำอะไรไม่ได้ครับ
Date :
2017-04-23 21:01:52
By :
mr.win
No. 2
Guest
Code (VB.NET)
Imports System.Net
Imports System.IO
Imports System.Text
Public Class Form1
Private Sub btnPayment_Click(sender As Object, e As EventArgs) Handles btnPayment.Click
Dim request As WebRequest
Dim Site As String = "https://www.paysbuy.com/paynow.aspx?"
request = WebRequest.Create(Site)
Dim response As WebResponse
Dim psb As String = "psb"
Dim biz As String = "[email protected]"
Dim inv As String = "TEST001"
Dim itm As String = "ทดสอบ Payment Gateway"
Dim amt As Double = 50
Dim postURL As String = ""
'Dim reqURL As String = ""
'Dim cCode As String = "บาท"
Dim postData As String = "psb=" & psb & "&biz=" & biz & "&inv=" & inv & "&itm=" & itm & "&amt=" & amt & "&postURL=" & postURL
MessageBox.Show(postData)
Dim data As Byte() = Encoding.UTF8.GetBytes(postData)
request.Method = "POST"
request.ContentType = "application/x-www-form-urlencoded"
request.ContentLength = data.Length
Dim stream As Stream = request.GetRequestStream()
WebBrowser1.DocumentStream = stream
stream.Write(data, 0, data.Length)
stream.Close()
response = request.GetResponse()
Dim sr As New StreamReader(response.GetResponseStream())
Dim paysbuy As String = sr.ReadToEnd()
TextBox1.Text = paysbuy
'WebBrowser1.DocumentText = paysbuy
End Sub
End Class