HELP: Winsock To Send HTTP POST REQUEST To A Machine
Hello,
I would like to use visual basic to send data to a machine using an HTTP Post request, and cannot decide on the best way to do it. Can I use winsock. Please bear in mind the following.
I am sending a mult-part message (kind of like an email with attachments). It's actually a multimedia message in the MM7 format -> this is similar to email, a multipart MIME message.
I MUST post to a destination using the following format:
http://192.168.3.75:2097/mm7
I need to then send the data which I've formated according to the MM7 spec.
I need to receive responses from the receving application.
Any help would be greatly appreciated.
Thanks
Ben
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Winsock HTTP POST - How Can You Send Files?
Like how can you send files that are sent by webbrowsers in the
<input type=file..> element?
anyone know?
i think its done by MIME, but how would you know what headers to use?
How To Build An Http Post Request ?
Recently i have been working on a small app that extracts data from a google sevice.
But now google has started an api service that allows users to directly post data to google accounts.here's the link
http://code.google.com/apis/accounts...alledApps.html
Now i have never worked with get/post http requests.So could some one guide on how to build one and then work with the responses that have arrived
Thanks
How Do I Send A Simple HTTP Request?
The code I have right now (copied from Microsoft's website) is this:
CODE Dim hInternetSession As Long
Dim hInternetConnect As Long
Dim hHttpOpenRequest As Long
Dim sBuffer As String * 1024
Dim lBufferLength As Long
lBufferLength = Len(sBuffer)
hInternetSession = InternetOpen(scUserAgent, _
INTERNET_OPEN_TYPE_PRECONFIG, vbNullString, vbNullString, 0)
hInternetConnect = InternetConnect(hInternetSession, _
"team.monkeycrap.com", INTERNET_DEFAULT_HTTP_PORT, _
vbNullString, vbNullString, INTERNET_SERVICE_HTTP, 0, 0)
hHttpOpenRequest = HttpOpenRequest(hInternetConnect, "GET", _
"/cgi-bin/clan.pl?action=setserver&player=" + clanMember + "&server=" + serverIP + "&port=" + serverPort, "HTTP/1.0", vbNullString, 0, _
INTERNET_FLAG_RELOAD, 0)
HttpSendRequest hHttpOpenRequest, vbNullString, 0, 0, 0
Still Trying To Send Cookie With HTTP Request
I can communicate with the server and the app works as long as a cookie exists on the workstation I am running on. The problem is that I need to be able to run on a workstation that does not have a cookie. I cut and pasted this out of Microsoft's VBHTTP example program. The cookie is just not going out correctly, if at all. Can anyone see what I am doing wrong? Thanks!
The URL is: is009999/dummy.com/ExprexxXXX?AccountId=12345678&TXN=SearchByAccountId&Format=XML"
Code: hInternetSession = InternetOpen(scUserAgent, INTERNET_OPEN_TYPE_PRECONFIG, _
vbNullString, vbNullString, 0)
If Not CBool(hInternetSession) Then
MsgBox "Cannot Connect to Network", vbCritical + vbOKOnly, "Get Customer Information"
ReadNet = ""
Exit Function
End If
dwPort = 7001
hInternetConnect = InternetConnect(hInternetSession, CheckUrl, dwPort, _
vbNullString, vbNullString, INTERNET_SERVICE_HTTP, 0, 0)
hHttpOpenRequest = HttpOpenRequest(hInternetConnect, "GET", GetUrlObject, "HTTP/1.1", vbNullString, 0, _
INTERNET_FLAG_RELOAD Or INTERNET_FLAG_KEEP_CONNECTION, 0)
SCookie = "Set-Cookie: ewebprefs=B,C,A,E@@NA@@999999@@NA@@V13"
iRetVal = HttpAddRequestHeaders(hHttpOpenRequest, SCookie, Len(SCookie), _
HTTP_ADDREQ_FLAG_REPLACE Or HTTP_ADDREQ_FLAG_ADD)
sHeader = "Accept-Language: en" & vbCrLf
iRetVal = HttpAddRequestHeaders(hHttpOpenRequest, sHeader, Len(sHeader), _
HTTP_ADDREQ_FLAG_REPLACE Or HTTP_ADDREQ_FLAG_ADD)
sHeader = "Connection: Keep-Alive" & vbCrLf
iRetVal = HttpAddRequestHeaders(hHttpOpenRequest, sHeader, Len(sHeader), _
HTTP_ADDREQ_FLAG_REPLACE Or HTTP_ADDREQ_FLAG_ADD)
sHeader = "Content-Type: text/html" & vbCrLf ' "Accept = image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd." & vbCrLf
iRetVal = HttpAddRequestHeaders(hHttpOpenRequest, sHeader, Len(sHeader), _
HTTP_ADDREQ_FLAG_REPLACE Or HTTP_ADDREQ_FLAG_ADD)
iRetVal = HttpSendRequest(hHttpOpenRequest, vbNullString, 0, sData, Len(sData))
DoEvents
Sleep 1000 'sleep for one second
sData = ""
Do
sBuffer = vbNullString
bRet = InternetReadFile(hHttpOpenRequest, sBuffer, Len(sBuffer), lNumberOfBytesRead)
If Not bRet Then Exit Do
If Not CBool(lNumberOfBytesRead) Then Exit Do
If (Len(sData) + lNumberOfBytesRead) <= 65534 Then
sBuffer = sBuffer & Left$(sBuffer, lNumberOfBytesRead)
sData = sData & sBuffer
End If
Loop
' Close Intranet connections
If hInternetURL <> 0 Then InternetCloseHandle (hInternetURL)
If hInternetSession <> 0 Then InternetCloseHandle (hInternetSession)
ReadNet = sData
End Function
Send Post Request To A Webpage
What's the "fastest" way to send a HTTP POST request to a webpage?
I know the winsock method. But I believe it is kinda slow.
Winsock HTTP Request Help
I need help with this, my wrapper uses winsock to send requests and the close event does not fire which makes the connection stay open forever, my wrapper is at the bottom it is a attachment
Send Post Request To Default Browser
Hi,
I was wondering if it is possible to send a 'POST Request' To a users default browser?
If i would do something like
Code:
ShellExecute Me.hwnd, "open", "www.mywebside.com/login.php?username=root&password=pass", "", "", SW_SHOWNORMAL
Then it would just open the browser, and send a GET request...
But then the website wont work, because it grabs the POST requests...
I know it is possible with a winsock control, but i need it to get posted in the users brower...
how should i do this?
Thanks
How Can Use Xmlhttp To Send A Post Request, And Have A Browser Opened With The Url De
I want to send a POST http request from VB to an HTTPServer. When the request is sent, I want a new browser to be opened with the url set to the same url as in the http request. How can I do that? the reason is that the url I want to send to need the user to authenticate first before processing the content in the request.
I'm using xmlhttp. the code I have below does get received by the http server. but I don't know how i can have the browser opened as a result of xmlhttp.
thanks in advance.
Private Sub posthttp_Click()
Dim xmlhttp As Variant
Set xmlhttp = CreateObject("MSXML2.XMLHTTP.3.0")
strUrl = <some url>
MsgBox strUrl
xmlhttp.Open "POST", strUrl, False
Dim xmldoc As Variant
Set xmldoc = CreateObject("MSXML2.DOMDocument")
xmldoc.loadXML ("<?xml version=""1.0""?><root/>")
xmlhttp.send xmldoc.XML
Set xmlhttp = Nothing
End Sub
[VB6] Winsock POST Request Problem
I'm trying to connecto to google.com and translate a simple word (just to test if works).
And I have a problem when I'm sending POST request data, here is my code:
Code:
Private Sub Command1_Click()
Winsock1.Close
Winsock1.Connect "www.google.com", "80"
End Sub
Private Sub Winsock1_Connect()
Dim packet As String
Dim strpost As String
strpost = "hl=it&ie=UTF8&text=hello&sl=en&sl=en&tl=it&tl=it"
packet = "POST /translate_t HTTP/1.1" & vbCrLf
packet = packet & "Host: www.google.com" & vbCrLf
packet = packet & "Accept: */*" & vbCrLf
packet = packet & "Accept-Language: it,it-it;q=0.8,en;q=0.5,en-us;q=0.3" & vbCrLf & vbCrLf
packet = packet & "Content-Type: " & "application/x-www-form-urlencoded" & vbCrLf
packet = packet & "Content-Length: " & Len(strpost) & vbCrLf
packet = packet & strpost
Winsock1.SendData packet
Text1.Text = Text1.Text & packet
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim data As String
Winsock1.GetData data
Text2.Text = Text2.Text & data & vbCrLf
End Sub
As you can see I want the GETDATA in Text2.Text but I recieve this error:
Code:
HTTP/1.1 411 Length Required
Date: Fri, 01 Aug 2008 13:57:24 GMT
Content-Type: text/html; charset=UTF-8
Server: GFE/1.3
Content-Length: 1357
{html code}
What's the problem?!
Thanks in advance.
VB, Winsock API, HTTP Post
I'm making a program that sends post data to a server. it's been working great until I tried to use my post sub to submit/update a webpage. the problem is it's only sending part of the post data. here is my post code...
Code:
Private Function PostUrl(url As String, data As String, Optional Referer As String = "")
On Error GoTo errHandler
Dim tosend As String
tosend = "POST " & GetDomainPath(url).Path & " HTTP/1.1" & vbCrLf
tosend = tosend + "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*" & vbCrLf
If Referer <> "" Then tosend = tosend + "Referer: " & Referer & vbCrLf
tosend = tosend + "Content-Type: application/x-www-form-urlencoded" & vbCrLf
tosend = tosend + "Host: " & WinSock1.LocalIP & vbCrLf
tosend = tosend + "Content-Length: " & Len(data) & vbCrLf
tosend = tosend + "Cookie: " & MakeCookieStr(url) & vbCrLf
tosend = tosend + vbCrLf & data & vbCrLf
Header = tosend
txtSource = ""
With WinSock1
If .State <> sckClosed Then .CloseSocket
.RemoteHost = GetDomainPath(url).Site
.RemotePort = 80
.Connect
End With
tmrTimeOut.Enabled = True
PostUrl = PostTag(url, data, Referer, Action)
Exit Function
errHandler:
ErrorIn "frmWebPage.PostUrl(url,data,Referer)", Array(url, data, Referer)
End Function 'PostUrl(url As String, data As String, Optional Referer As String = "")
I looked at data var, it's compleat. so I know it's passing everything. for some reason though it's not "submiting" it all to the page. any ideas on why this may be? btw, I am useing winsock api, just got a class that acts alot like the winsock control. but doesn't need the ocx
Winsock HTTP Post
Basically i wanted to integrate Vonage (VOIP) Click 2 Call Features into My App
I have found the Html Code:
Code:<form action="https://secure.click2callu.com/tpcc/makecall" method="POST">
username <input name="username"><br>
password <input name="password" type="password"><br>
fromnumber <input name="fromnumber"><br>
tonumber <input name="tonumber"><br>
<input type="submit">
</form>
How can i use this within VB rather than a Html File?
Thanks in advance!!
duttydea
Winsock With HTTP-POST
Hi,
I'm fairly new to VB6 and have started working on my second application.
I require the application to send a string to a PHP page on a website and have the PHP page handle the string sent.
I can establish the connection with winsock fine, but i'm unsure as to where to go next.
I've have a decent amount of knowledge with PHP, but just getting the data from VB6 to PHP is where i'm stuck.
After reading numerous posts and tutorials, everything seems to be pointing at using HTTP-POST, but none have succeeded in helping me to accomplish my goal.
If anyone could kick me in the right direction it would be greatly appreciated.
Alternate HTTP POST Method Using XMLHTTP (Winsock/INET Control Problems)
I have a rather large application that we have been developing at work for about a year now that has a custom VB6 client and an ASP/VBScript server backend.
The application has been running pretty good on the INET control using the HTTP GET method for posting our queries to the server, but we have recently encountered the problem where some of our forms are larger then the 2k limit on HTTP GET. We have tried modifying the size of the allowed GET query/URL on the server (IIS6) but have been unable to get this to work either.
We then tried switching over to HTTP POST using INET and the StateChanged event. The problem is that the StateChanged event will never execute because the .Execute is located in a Module, but the INET Control and StateChanged event are located on our main Form. ARGH! Nothing we try seems to work with this method, and there are 100's of routines on aprox 20 forms that are calling our code in the Module when they need to query the server!
Yesterday I tried playing around with using the WinSock control - BUT IT SEEMS TO HAVE THE SAME PROBLEM! I am thinking there is a "bug" of sorts in VB6 that will not allow the StateChanged to fire if you utilize a control from another form or module that is not the original form the control is located on.
Today I am looking for a new method of implementing HTTP POST and retrieving the results that does not require the use of StateChanged. Any ideas?
Thanks for your time,
Dancing Hippo
How To Send A File In Winsock (http Way)
I mean, if i have a winsock on a form
and i set it to listen on port 80
then i have a file in App.Path & "pic.jpg"
How can i do it so that when anyone connects to my app
(anyone = Explorer or Netscape)
then will get the picture displayed..how to do that??
I know how to send text files (eg: 'txt *html *.htm ...)
But I cannot manage to send files like JPG GIF ZIP and so..
How cani do that?
Please..I need this...so badly...
Thanks in advance!
How To Send POST Data With Winsock In VB
I am trying to send POST data with Microsoft Winsock control but keep on receiving garbage from the webserver. Can anyone tell me the reason please?
What I send:
POST /search HTTP/1.1
Host: www.google.com
Content-Length: 30
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Media Center PC 3.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Connection: close
hl=en&q=sql+tutorial&btnG=Google+Search
What I get:
HTTP/1.1 501 Not Implemented
Connection: close
Content-Type: text/html
Server: GWS/2.1
Transfer-Encoding: chunked
Content-Encoding: gzip
Date: Mon, 23 Oct 2006 17:08:55 GMT
Cache-Control: private, x-gzip-ok=""
Post Info To A URL Using Asp Script And Getting Results Like Http Method Post.
I am trying to find script or just where to start.
I want to use asp script (server side) to post some hidden info to another server(URL), then get the info back from the return page and parse through the text to return a page based on the text in the return page.
I Don't want to have the user forwarded to the page that the post is going to I just want to post info to the URL and get the data back. Then create a page based on the data.
Any help with this will be much appreciated.
Thanks,
Dave
Me Again-http Request
im using the inet control to make an http request. the server requires basic authentication (use of .htaccess and .htpasswd files for those of u who know about webservers, at least thats how it works with apache)
the problem is i dont understand how to authenticate.
i tried the usernameassword@site.com which a) is less secure so id rather not use it and b)it didnt even work
here are the specs
http://www.zoneedit.com/doc/dynamic.html#faq11
i need to be able to authenticate my username and password, and provide the host parameter
i have no clue how to do this with the inet ctrl.
plz help
HTTP Request
Hi,
I'm trying to make a application in visual basic where I need to block a HTTP request (URL) from a browser and display a default pae from the cache. the default page entry should be made in the cache in such a way so that the URL doesn't change. means instead of the actual page that will be returned i need to show another HTML content.
any help will be highly appreciated.
Thanks in advance.
Raj
HTTP Request
Hi,
I'm trying to make a application in visual basic where I need to block a HTTP request (URL) from a browser and display a default pae from the cache. the default page entry should be made in the cache in such a way so that the URL doesn't change. means instead of the actual page that will be returned i need to show another HTML content.
any help will be highly appreciated.
Thanks in advance.
Raj
HTTP Request
Hi,
I'm trying to make a application in visual basic where I need to block a HTTP request (URL) from a browser and display a default pae from the cache. the default page entry should be made in the cache in such a way so that the URL doesn't change. means instead of the actual page that will be returned i need to show another HTML content.
any help will be highly appreciated.
Thanks in advance.
Raj
Http Request
can anyone tell how to capture http requests in order to block websites?
HTTP Request
....my project is written as an ActiveX component, and doesn't have any
form. I need to make a HTTP request to an IIS server and get the contents of
a specific ASP file through this component. I'm trying to use the WebBrowser
control, and using the WebBrowser.Navigate2 "url" method to get at this
file. However, I keep getting an error saying 'invalid procedure call or
argument'. I've also tried using the XMLHTTPRequest object, with no success.
I'm assuming this is because the it's within an ActiveX project... I've
managed to do the same thing successfully using a WebBrowser control (with the same URL) when the
project is a standard EXE. Anyone know of any other way to achieve this?
Any thoughts, ideas, musing....thanks!
Pocket Pc Http Request
Hi,
I am developing a program to download data from http. The following code works fine for normal windows application. However, when I tests it using pocket pc phone edition 2003 emulator/ pocket device. it gives me the following error:
Chunk length was not valid.
Private Sub frmAccBalance_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim balance As Double
Dim str As String
Dim message As String
Me.ControlBox = False
Dim url As String = "http://203.92.112.140/vsmsc/checkBalance.php?sip_phone_no=657047&pin=12345678"
Try
Dim HttpWReq As HttpWebRequest = CType(WebRequest.Create(url), HttpWebRequest)
HttpWReq.AllowWriteStreamBuffering = True
HttpWReq.Method = "GET"
Dim HttpWResp As HttpWebResponse = CType(HttpWReq.GetResponse(), HttpWebResponse)
Dim ReceiveStream As Stream = HttpWResp.GetResponseStream()
Dim encode As Encoding = System.Text.Encoding.GetEncoding("utf-8")
Dim sr As New StreamReader(ReceiveStream, encode)
Dim read(256) As [Char]
Dim count As Integer = sr.Read(read, 0, 256)
While count > 0
str = New String(read, 0, count)
lblBalance.Text = (str)
count = sr.Read(read, 0, 256)
End While
Catch ex As WebException
message = ex.Message
Dim response As HttpWebResponse = CType(ex.Response, HttpWebResponse)
If Nothing Is response Then
Else
message = response.StatusDescription
response.Close()
End If
lblBalance.Text = message
Catch ex As Exception
lblBalance.Text = ex.message
End Try
End Sub
What is it with pocket pc phone edition? Any idea would be greatly appreciated.
Thanks in advance
HTTP Request Headers
Please help if you can. I am sending a GET request and I want to exactly emulate the IE HTTP Request Headers. I have even used a packet sniffer to try to replicate the request headers and have still have not found one way to write them that works for all GET requests. I get some to work with "& CrLf & CrLf" on the end of the headers and other times I have to put "& CrLf & CrLf & CrLf & CrLf" on the end to avoid getting a bad request message from the web sever I am sending the request to. If anyone know exactly what I should send in my HTTP Request headers to emulate IE, I would GREATLY appreciate it. Thanks!
Http Request Handling
hello,
I am sending an Http Request which contains xml string to the browser through VB. But when the Length of xml string extends the maximum limit, the function which i have written doesn't works.
The problem is with the browser. it cannot accept more than 2000 characters, where as my string exceeds the limit !!!
Is there any API which can set the browsers max limit ???
Can anybody out there can solve my problem ..???
Http Request To A DLL Function @ IIS
Hi all....
Please help on this soon... If someone can post a sample code it is more useful for me at this time....
Question:
Is there any way to make http request to a DLL function, which resides in a IIS server, through Vb using API..Without using a OCX like(MSINET.OCX)....
Because this OCX causes crash my application at least without giving a single error message....
-Buddhi
How Can I Respond To An HTTP Request ?
hello all
I want my app to respond to browser request. How can my app send respond header ?
is it just sending a string containing the respon header to browser ?
if I want to add a file to send after the header, can I do it by sending binary transfer after I sent all the respon header ?
thanx
How Do I Make An Http Request?
Hiya!
I'm wondering if it is possible to make an http request from a VB6 program and how it is done??
What I want to do is checking a lot of links and see if they are alive.
Thanks,
Magnus Ohlin
How To Make A Post Request Using Vb6?
Hi all. I got a vb 6 form that has a a few text boxes that users fill their name and address and a text massage and a submit button. I wonder how i can make a post request on click of this button to a php page so it recives that data from vb6 form. I be happy if some one tell me how i can make such post
request.Thanks
How To Make Post Request To Php From My Vb6 App?
Hi all i wonder if i can make my vb6 application to talk to a php page and send the php page some mysql statment that it executes in remote server.I want to send an HTTP Request, like a POST, with some data for the PHP script to use.I be happy if i get some help here.Thanks
Login & Password In HTTP Request
I am doing a HTTP Request to Exchange Server to retrieve some users Calendar data. Such as
http://exchange.company.com/public/?...nis.company.my
It returns me with a result into XML Format about the user availability.
That all works fine for me, except that i have to provide login and Password for exchange server. Can i include login/password in a HTTP Request (URL) itself. Later i have to integrate it in my VB Program and Parse XML. Please advise.
Opinion Request - FTP, SFTP, HTTP, Or OTHER???
Hello all. We have bookkeeping/accounting/tax software program that we wrote in VB6 which various clients use. We currently have them email us a .txt file of data which we then manually import into our master program. We also have a new web site, and .com domain, but I'm not sure of the potential for either in this regard.
My question is, what do you all recommend as the best approach to automate that data entry process: FTP, SFTP, HTTP, or OTHER??? Note that in the future we may also automate the "banking" part of this to where "direct deposit" of money is involved. So, confidential information like social security numbers and possibly bank routing numbers may be involved in the future.
If I understand the principles of this correctly, we just need to have the client send, or post the data somewhere, then we need to be able to get it and import it. What I have no idea about is what is the best approach to do all that or if it can be done in one step. What are the pro's and con's of the various methods?
Thank you for any input and suggestions on what you would recommend and why.
bjmarler
Get IP Address (external) From HTTP Request
Hello everybody.
While making an HTTP Request, there are lots of information about the client in the HTTP Header, such as IP address of the client. So its possible to get the client's IP address; the external IP by looking for it in the header. So what I want is to send a request to abc.com, grab the header and then filter the IP address out of it.
So any help on how can I start this?
Thanks.
Vb Uploads A File Via Http Request
hola!
i am realy @ the end.... please try to help me!!
i spent hours looking throu tonns of help pages and newsgroups.
i just want to write a vb programm (activex thing used in another webpage) that uses a html page to post an image file.
i got the code to work but only once...
when i start the ocx it possible to make one request to the page, which functions quite well (althou it still dosn't upload a file - but don't care) and after compleating the function the programm goes on running but its not possible to klick anything or do anything.... the mousecursor stays set to bussy but the programm is just waiting for userinteraction....
so i just can stop the activex and rerun it - it works again but just once
here is the code (its a sample from http://www.tagconsulting.com/show.asp?Id=1025&S=3)
Code:Sub formpost()
'from http://www.tagconsulting.com/show.asp?Id=1025&S=3
'http://dev.uboot.com/cgi-bin/photoup.fcgi
' Open the connection
Dim hInternetOpen As Long
Dim hInternetConnect As Long
Dim hHttpOpenRequest As Long
hInternetOpen = InternetOpen("http generic", _
INTERNET_OPEN_TYPE_PRECONFIG, _
vbNullString, _
vbNullString, _
0)
' Identify the type of service that is being accessed
hInternetConnect = InternetConnect(hInternetOpen, _
"dev.uboot.com", _
INTERNET_DEFAULT_HTTP_PORT, _
vbNullString, _
"HTTP/1.0", _
INTERNET_SERVICE_HTTP, _
0, _
0)
hHttpOpenRequest = HttpOpenRequest(hInternetConnect, _
"POST", _
"/cgi-bin/photoup.fcgi", _
"HTTP/1.0", _
vbNullString, _
0, _
INTERNET_FLAG_RELOAD, _
0)
Dim sHeader As String
Dim bResult As Boolean
sHeader = "Content-Type: application/x-www-form-urlencoded" & vbCrLf
bResult = HttpAddRequestHeaders(hHttpOpenRequest, _
sHeader, Len(sHeader), HTTP_ADDREQ_FLAG_REPLACE _
Or HTTP_ADDREQ_FLAG_ADD)
Dim lpszPostData As String
Dim lPostDataLen As Long
lpszPostData = "Id=1&S=2"
lPostDataLen = Len(lpszPostData)
bResult = HttpSendRequest(hHttpOpenRequest, _
vbNullString, _
0, _
lpszPostData, _
lPostDataLen)
Dim sBuffer As String
Dim sReadBuffer As String * 2048
Dim bDoLoop As Boolean
Dim lNumberOfBytesRead As Long
bDoLoop = True
While bDoLoop
sReadBuffer = vbNullString
bDoLoop = InternetReadFile(hHttpOpenRequest, _
sReadBuffer, Len(sReadBuffer), lNumberOfBytesRead)
sBuffer = sBuffer & _
Left(sReadBuffer, lNumberOfBytesRead)
If Not CBool(lNumberOfBytesRead) Then
bDoLoop = False
End If
Wend
MsgBox (sBuffer)
bResult = InternetCloseHandle(hHttpOpenRequest)
bResult = InternetCloseHandle(hInternetConnect)
bResult = InternetCloseHandle(hInternetOpen)
'Screen.MousePointer = 1
End Sub
p.s. the dev.uboot.com/cgi-bin/photoup.fcgi is not able to be accessed via the net - but it is functioning - i uploaded some photos....
it would be veryvery nice to get any ideas...
peace
michi
Read An HTTP Request Header ?
hello all.....
how can my app read an HTTP header request (from browser such as IE)?
how can I send a response header ?
is HTTP header is just a string ?
BIG Thanx
PS : I'm using VB, if you give me source code to do it, it would very nice
.....
Post Request Webbrowser Control
Ok basicly I am working on a little project i call Google Office
I need to create a gui login and simulate a post request to the google login webpage...
and then navigate to the google docs main screen after login how would I do this?
wb.navigate2 URL,,PostData?
Help
HTTP POST In VB6
I have been working on an application that will upload a zip file from a computer to a websever using HTTP POST. I have been able to transmit data that would otherwise appear as text, but I have been having problems with the binary data in the zip file. I can upload it fine using a standard web form (input type="file" name="zip_file"...), but when I try sending the same file from my program, I only get the first 800 bytes or so. Here are some code fragments.
First, This is the code used to make the buffer which will be posted. UrlEncode remove spaces and other forbidden characters from the username. That part works perfectly.
Code:
Private Sub LoadZipFile()
On Error GoTo LoadError
Dim tempBuffer As String
user = mUpload.UrlEncode(user)
mUpload.postBuffer = "handle=" + user + "&zip_file="
Open zipPath For Binary Access Read As #1
Dim length As Long
length = LOF(1)
tempBuffer = String$(LOF(1), 0)
Get #1, , tempBuffer
Close #1
length = Len(tempBuffer)
mUpload.postBuffer = mUpload.postBuffer + tempBuffer
length = Len(tempBuffer)
workState = 6
Exit Sub
LoadError:
MsgBox ("There was an error loading the zip file to memory.")
workState = 9
End Sub
And later after all the connections are made, the buffer sent to the server using this code. hURL is a handle to the script on the server, returned from HttpOpenRequest from the winInet.dll library. HttpSendRequest is part of the same library.
Code:
If HttpSendRequest(hURL, "", 0, postBuffer, Len(postBuffer)) Then
Http Post
I've searched high and low and cant seem to find a straight forward solution to my problem. I'll explain quickly what I'm trying to do. I have added a context menu item in outlook 2003 to capture the html body of an email. I want to send the contents of the variable where I have stored this html body to and ASP but I can't seen to find how to do it. I'm sure I have to use and Http post. HELP PLEASE!! Thanks in advance.
HTTP Post
Hello everyone,
I really hope someone can help me with my problem.
My company recently signed up with a credit card processing firm. Everytime a CC is processed the firm places it onto their website. In order for us to get this information we need to go to their site and enter parameters to view the information. They have supplied me with an html button that I can view the source and see all the parameters that I need to pass so I can view the report. They also informed me that I need to use HTTP Post if trying to use VB to accomplish what their web button did.
I am attempting to create a VB program that will pass these parameters to their site so we can automate this process in the background and don't actually have to visit the site.
Now, for my problem.
I have been attempting to use the Inet.execute , "Post" command to send these parms but it doesn't seem to be working.
I believe that I may have the format wrong or something of that sort.
I have included a text file that has the html code for the button. I did however remove all the login info so if it is clicked you will only see a login screen.
If someone could show me the correct way to send this info to their server I should get a report shown when I run the program.
I 'm hoping someone could give me an example of what I need to do to get this into my VB app.
If I can get it to the page the report is on I can handle retrieving the information from the site.
If I am unclear or anyone would like more info, please let me know and I'll get back to you asap.
File.txt - If this is renamed to File.html it will show a button that can be clicked. When this is clicked it will show a login screen since I removed the login information.
Code.txt - This contains the code I am using in VB to try and perform the same action that the html button is performing.
Thanks in advance for all the help,
Solturus
|