Hỗ trợ thêm xuất nội dung file dữ liệu từ trang web

Liên hệ QC

tuanhuycntt

Thành viên chính thức
Tham gia
5/7/15
Bài viết
65
Được thích
5
Các anh chị hỗ trợ giúp em đoạn code của phần này với ạ.
Nội dung là em muốn login vào trang web của công ty xuất ra file dữ liệu để báo cáo. Do phần gạch chân đỏ của bức ảnh (số 6149) là số ngẫu nhiên được thay đổi trong các quá trình tìm kiếm.
Các công đoạn truy cập vào trang web và tìm kiếm em đã làm xong. Chỉ còn phần "Export" em chưa biết phải viết như thế nào.
Nếu tạo lệnh Click vào thì nó lại hỏi lưu và không biết cách xác nhận ra sao.
Các anh chị hỗ trợ giúp em có thể xuất được file đó chọn vị trí lưu ra từ đường link ẩn "http://voip.apaxenglish.com/index.php/cdr/export/6149"

PHP:
Option Explicit
Const url = "http://voip.apaxenglish.com/index.php/user"
Const user = "user"
Const pwd = "password"
Const sdt = "44301"

'Sub test()
'Dim iURL
'Dim objShell
'    iURL = "www.google.vn"
'    Set objShell = CreateObject("Shell.Application")
'    objShell.ShellExecute "chrome.exe", iURL, "", "", 1
'End Sub

Sub LoginWEB()
    Dim IE As Object
    Dim a As String
   
    a = Format(Date - 1, "mm/dd/yyyy")
    TaskKill ("iexplore.exe")
    Set IE = CreateObject("InternetExplorer.Application")
    IE.navigate url
    Do While IE.readyState <> 4
        DoEvents
    Loop
    IE.Visible = True
 
    With IE.document
        .GetElementByID("inputEmail3").Value = user
        .GetElementByID("inputPassword3").Value = pwd
        .forms(0).submit
Application.Wait (Now + TimeValue("0:00:02"))
        .GetElementByID("caller_number").Value = sdt        'caller number
        '.GetElementByID("dest_number").value = "xxxxx"     'destination
        .GetElementByID("calendar_from").Value = a          'start date
        .GetElementByID("calendar_to").Value = a            'end date
       
Application.Wait (Now + TimeValue("0:00:02"))

        '.GetElementByID("hour_start").selectedIndex  = "xxxxx"
        '.GetElementByID("min_start").selectedIndex  = "xxxxx"
        .GetElementByID("hour_finish").selectedIndex = "23"
        '.GetElementByID("min_finish").selectedIndex  = "xxxxx"
        .GetElementByID("filter").Click     'nut Search
Application.Wait (Now + TimeValue("0:00:05"))
        .GetElementByID("export").Click     'nut export
   End With
End Sub

Private Function TaskKill(sTaskName)
    TaskKill = CreateObject("WScript.Shell").Run("taskkill /f /im " & sTaskName, 0, True)
End Function


1536487339703.png
Bài đã được tự động gộp:

Vì hiện tại trang web này chỉ mở được khi ở mạng nội bộ nên các anh chị không truy cập được. Anh chị nào rành cũng như biết về các thông tin ở trên hỗ trợ giúp em thêm với ạ. Em xin cảm ơn
 
Lần chỉnh sửa cuối:
Web KT

Bài viết mới nhất

Back
Top Bottom