|  | 
 
|  
 
 จากตอนที่แล้ว [VB.NET] แจกฟรีโค้ดการแจ้งเตือนผ่าน Line หรือที่เรียกกันว่า Line Notify ประเดี๋ยวมิตรรักแฟนคลับสาย VB6 จะน้อยอกน้อยใจ เอะอะอะไรก็มีแต่โค้ด VB.NET คราวนี้แอดมินก็ขอจัดโค้ดให้กับสาวก VB6 ได้รับชมกันครับ ... อันที่จริงหากเราเข้าใจในเรื่องของ POST Method ที่ใช้งานบนเว็บ ก็จะสามารถทำออกมาได้ไม่ยากเลยครับพี่น้องหมู่เฮาชุมชนคนรักภาษาเบสิค ... UHU
 
 
 มาดูโค้ดกันเถอะ ...
 
 คัดลอกไปที่คลิปบอร์ด' / --------------------------------------------------------------------------------
' / Developer : Mr.Surapon Yodsanga (Thongkorn Tubtimkrob)
' / eMail : thongkorn@hotmail.com
' / URL: http://www.g2gnet.com (Khon Kaen - Thailand)
' / Facebook: https://www.facebook.com/g2gnet (For Thailand)
' / Facebook: https://www.facebook.com/commonindy (Worldwide)
' / Purpose: Line Notify with Visual Basic 6
' / Microsoft Visual Basic 6.0 (SP6)
' /
' / This is open source code under @CopyLeft by Thongkorn Tubtimkrob.
' / You can modify and/or distribute without to inform the developer.
' / --------------------------------------------------------------------------------
Option Explicit
Sub SendMessage()
    On Error GoTo ErrHandler
    
    Dim oXML As Object
    Dim strToken As String
    Dim strMessage As String
    Dim strDate As String
    Dim URL As String
    '// Line Notify Access Token
    strToken = "YOUR TOKEN HERE"
    '// Line Notify
    URL = "https://notify-api.line.me/api/notify"
    
    strMessage = Trim(txtMessage.Text)
    strDate = Format(Now, "dd/MM/yyyy - hh:mm:ss")
    '//Line Message
    strMessage = "message=" & strMessage & vbCrLf & " Date-Time: " & strDate
    '//
    Set oXML = CreateObject("Microsoft.XMLHTTP")
    With oXML
        '// Line POST Method
        .Open "POST", URL, 0
        '// Header
        .SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
        .SetRequestHeader "Authorization", "Bearer " & strToken
        '// Send message
        .send (strMessage)
        '// Debug Line
        'Debug.Print oXML.responseText
    End With
    
    Set oXML = Nothing
    Exit Sub
    
ErrHandler:
    '// Error
    MsgBox Err.Number & vbCrLf & Err.Description
End Sub
Private Sub cmdSend_Click()
    If Trim$(txtMessage.Text) = "" Or Len(Trim$(txtMessage.Text)) = 0 Then Exit Sub
    Call SendMessage
End Sub
Private Sub cmdExit_Click()
    Unload Me
End Sub
Private Sub Form_Load()
    txtMessage.Text = "ทดสอบการส่งข้อความผ่าน Line Notify จากคุณทองก้อน นารีแขยง"
End Sub
Private Sub Form_Unload(Cancel As Integer)
    Set frmLineNotify = Nothing
    End
End Sub
 ดาวน์โหลดโค้ดฉบับเต็ม VB6 ได้ที่นี่ ...
 
 
 | 
 
xขออภัย! โพสต์นี้มีไฟล์แนบหรือรูปภาพที่ไม่ได้รับอนุญาตให้คุณเข้าถึงคุณจำเป็นต้อง ลงชื่อเข้าใช้ เพื่อดาวน์โหลดหรือดูไฟล์แนบนี้ คุณยังไม่มีบัญชีใช่ไหม? ลงทะเบียน  |