|
-
Sep 24th, 2002, 12:12 PM
#1
Thread Starter
Hyperactive Member
Internet Transfer Control -> POST
I'm trying to use the MS Internet Transfer Control to POST data to a CGI script. I have the URL correct, and I *believe* the data is formatted properly‡, but what I don't know is what needs to be placed in the InputHeaders argument.
What I am sending to the CGI script is a MIME encoded HTML email message, from a VB App ...can anyone tell me what I would need to put as headers?
‡The script is running on a UNIX machine, and someone told me that there may be an issue with CrLf's, but I'm not sure what is true. All my lines are terminated by CrLf.
And I, for one, welcome our new insect overlords. I'd like to remind them as a trusted TV personality, I can be helpful in rounding up others to toil in their underground sugar caves.
-
Sep 25th, 2002, 02:07 AM
#2
Fanatic Member
-
Sep 25th, 2002, 02:22 AM
#3
PowerPoster
Why don't you try using vbCr and vbLf seperately. One of them should succeed. If you get through, please post the code.
-
Sep 25th, 2002, 02:23 AM
#4
PowerPoster
And also post the code for creating POST data also.
-
Sep 25th, 2002, 07:31 AM
#5
Thread Starter
Hyperactive Member
I did try replacing all vbCrLf with just vbCr or just vbLF but it did not work..
I will try some more stuff, but this is the code I am using.
VB Code:
If InStr(1, sMimeSource, "This is a multi-part message in MIME format.") = 0 Then
sMimeSource = vbCrLf & vbCrLf & vbCrLf & vbCrLf & "This is a multi-part message in MIME format." & vbCrLf & vbCrLf & sMimeSource
End If
'Here's what I try to post. All of the field names are correct
sPostData = "mailto=" & SendTo & "&mailfrom=" & SendFrom _
& "&subject=" & SendSubject & "&maildata=" & sMimeSource
'This is what I pass to the .Execute method. I don't know if the
'InputHeaders parameter is correct...
.Execute URL_MY_CGI, "POST", sPostData, "Content-Type: application/x-www-form-urlencoded"
I tried passing sMimeSource as the actual MIME encoded email, in which case I got a blank email back from the server with some AT00001.txt file attached (empty)
I also tried passing the MIME through this function that someone else on these boards posted (which takes WAY TOO LONG ~88 seconds) to convert..and still does not work.
VB Code:
'Encodes a string in www-form-url format
Private Function Encode_x_www_form_url(Data As String) As String
Dim strOutput As String
Dim intAsc As Integer
Do Until sData = ""
intAsc = Asc(Mid(Data, 1, 1))
Select Case intAsc
' Case 0-9, A-Z, a-z, SP, :, ;, /, \, ?, @, &, =, +, , , $
Case 48 To 57, 65 To 90, 97 To 122, 46, 58, 59, 47, 92, 63, 64, 38, 61, 43, 44, 36 'Alphanumeric characters
strOutput = strOutput & Chr(intAsc)
Case 32 'Space
strOutput = strOutput & "+"
Case Else 'Any non alphanumeric character.
If intAsc <= 10 Then
strOutput = strOutput & "%0" & Hex(intAsc) 'Pad
Else
strOutput = strOutput & "%" & Hex(intAsc)
End If
End Select
Data = Mid(Data, 2)
Loop
Encode_x_www_form_url = strOutput
End Function
And I, for one, welcome our new insect overlords. I'd like to remind them as a trusted TV personality, I can be helpful in rounding up others to toil in their underground sugar caves.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|