Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > Courses > Access > Developer > D32 > D32 Lessons < D31 Lessons | D33 Lessons >
Back to Access Developer 32 Lessons    Comments List
Post Data which one is better Upload Images   Link   Email  
Mubeezi Micah 
Hi Rick,

My question is on lesson 6 where you show the alternatives to the webbrowser control. I find it cool. I would like you;
1. To demonstrate how to use the post method using any of these two ways shown in the lesson.
Set XMLHTTP = CreateObject("MSXML2.ServerXMLHTTP")
'Set XMLHTTP = CreateObject("MSXML2.XMLHTTP")

2. I came across another way to go to a web page using VBA without the web browser control. I paste it below;
Public Function HTTPPost(URL As String, Msg As String)  'send HTTP POST to a server:
    With CreateObject("WinHttp.WinHttpRequest.5.1")
        On Error Resume Next        'ensures code contiunes to run without internet
        .Open "GET", URL, True      'True is asynchronous so UI does not hang
        .setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
        .setRequestHeader "Content-type", "application/x-www-form-urlencoded"
        '.SetRequestHeader "secret-pass-key", "your-key"    <--if needed
        .send Msg                   'throws an error when there is no internet
        .WaitForResponse            'pauses execution, but does not hang UI
                
        HTTPPost = .responseText
        
    End With
End Function

Now i am in a dilemma. Which of the three options should i use? Which one is future proof? Which one is better?

Thank you!

MICAH
Richard Rost 
XMLHTTP and WinHttpRequest are very similar. That's really just a matter of preference. I've been using XMLHTTP for years with no issues. Both are definitely superior to the webbrowser control - unless your goal is to display something in a web browser for the user.
Richard Rost 
And yes, I'll be covering POST soon. Usually you only use that with form field submissions.
Mubeezi Micah 
Thank you Rick for clarifying

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer 32 Lessons.
 

 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 3/28/2024 6:55:20 AM. PLT: 0s