13 Jul 2012 01:49
Is it possible to simply write to a socket?
Igor Korot <ikorot01 <at> gmail.com>
2012-07-12 23:49:42 GMT
2012-07-12 23:49:42 GMT
Hi, ALL,
I'm transferring the code from VB to C/C++ to make it cross-platform.
In VB, there is following code:
[code]
Dim boundary As String = "---------------------------" &
DateTime.Now.Ticks.ToString("x")
Dim newLine As String = System.Environment.NewLine
Dim boundaryBytes As Byte() =
System.Text.Encoding.ASCII.GetBytes(newLine & "--" & boundary &
newLine)
Dim request As Net.HttpWebRequest = Net.WebRequest.Create(uri)
request.ContentType = "multipart/form-data; boundary=" & boundary
request.Method = "POST"
request.KeepAlive = True
request.Credentials = Net.CredentialCache.DefaultCredentials
Using requestStream As IO.Stream = request.GetRequestStream()
requestStream.Write(boundaryBytes, 0, boundaryBytes.Length)
End Using
[/code]
AFAIU, it just simply writes boundary bytes to the socket as an ASCII
bytes sequence.
There is post-ing involved, no form submittal
Is it possible to do the same with libcurl?
Because with the following approach:
(Continue reading)
In your case I can imagine that you need to send a few HTTP POST's to get
the complete job done. This is all doable and there are example on how to
make this even more nice on the Curl website.
I think this information might be of assistance too:
RSS Feed