Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2015
1,049
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. Dim Post As System.Net.WebRequest = System.Net.WebRequest.Create("http://gdata.youtube.com/feeds/api/videos/IkkDV6_YEMQ/comments HTTP/1.1")
  2. Post.Method = "POST"
  3. Post.ContentType = "application/atom+xml"
  4. Post.Headers("Authorization") = "AuthSub token=""2FsdGE1VMjVB4OGFOAHGPJIwqzzE_T1flswzxpNLWjJDF90RDknAdJa_sgfheVM0XT"""
  5. Post.Headers("GData-Version") = "2"
  6. Post.Headers("X-GData-Key") = "key=Key"
  7. Post.ContentLength = MessageText.TextLength
  8. Dim newStream As Stream = Post.GetRequestStream()
  9. newStream.Write(Encoding.ASCII.GetBytes(MessageText.Text), 0, MessageText.TextLength)
  10. Console.WriteLine("The value of 'ContentLength' property after sending the data is {0}", Post.ContentLength)
  11. Dim response As HttpWebResponse = CType(Post.GetResponse(), HttpWebResponse)
  12.  
  13. Console.WriteLine("Content length is {0}", response.ContentLength)
  14. Console.WriteLine("Content type is {0}", response.ContentType)
  15.  
  16. ' Get the stream associated with the response.
  17. Dim receiveStream As Stream = response.GetResponseStream()
  18.  
  19. ' Pipes the stream to a higher level stream reader with the required encoding format.
  20. Dim readStream As New StreamReader(receiveStream, Encoding.UTF8)
  21.  
  22. Console.WriteLine("Response stream received.")
  23. Console.WriteLine(readStream.ReadToEnd())
  24. response.Close()
  25. readStream.Close()
  26. newStream.Close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement