Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8890717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:33:58+00:00 2026-06-14T22:33:58+00:00

I am trying to post 2 variables to a php script and then return

  • 0

I am trying to post 2 variables to a php script and then return the text that is displayed on the website.

I VB6, I did it the following way, it worked perfectly fine.
Can somebody please tell me how to do this in VB.NET?

Public Function GetHTTPResponse() As String

Dim sPost$
sPost$ = "http://www.somedomain.com/somescript.php"
sPost$ = sPost$ & "?variable1=MYVAR1"
sPost$ = sPost$ & "&variable2=MYVAR2"

'=======================================================
'"?" Prefix 1st Variable, "&" prefix for subsequent vars
'=======================================================
Dim iPos&
iPos = InStr(sPost, "?")
If (iPos = 0) Then
    Exit Function
End If

Dim sDomain$
sDomain$ = Left$(sPost, (iPos - 1))

'====================================
'Pack the post data into a byte array
'====================================
Dim sPostData As String
sPostData = Right$(sPost, Len(sPost) - iPos)

Debug.Print sPostData

Dim bytpostdata() As Byte
pBuildPostData bytpostdata(), sPostData

'=============================
'Write the byte into a variant
'=============================
Dim varPostData As Variant
varPostData = bytpostdata
'=================
'Create the Header
'=================
Dim sHeader$
sHeader = "application/x-www-form-urlencoded" + Chr(10) + Chr(13)
'=============
'Post the data
'=============
Dim xmlhttp As Object
Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")

xmlhttp.Open "POST", sDomain, False
xmlhttp.setRequestHeader "Content-Type", sHeader
xmlhttp.sEnd varPostData

Dim sRet$
sRet = xmlhttp.responseText

GetHTTPResponse = sRet

End Function
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:34:00+00:00Added an answer on June 14, 2026 at 10:34 pm

    I finally found the solution here:

    http://www.pcreview.co.uk/forums/using-webclient-webrequest-webresponse-post-postdata-and-get-result-t1222629.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write a PHP script that will create an HTML form
I'm trying to send an array to a PHP script via POST method. First
I'm trying to create a script with PHP and cURL that extracts the emails
I'm trying to implement some kind of caching in a PHP script that will
I'm trying POST a check-in request in Google Places API. The way they described
I am trying to make an ajax call to a php script. The php
I'm trying to write a simple PHP script which automatically sets up new etherpads
I have a PHP script that runs once a day, and it takes a
Currently if a user POST/uploads a photo to my PHP script I start out
I am trying to send a name:value pair to a php script using the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.