Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

.NETMF Toolbox HTTP Client issue


  • Please log in to reply
4 replies to this topic

#1 marky-b

marky-b

    Member

  • Members
  • PipPip
  • 17 posts

Posted 24 November 2011 - 04:48 AM

I working with Stefan's .NETMF Toolbox to scrape some info from a page.

I created a really basic "web service" of sorts that uses the magic of PHP to fetch and present the number of unread emails in my Gmail account (its located at http://markweinmann.com/gmail.php)

When i hit the page manually, the source of the page is "367" (or how ever many unread emails i have), but when i use the .NETMF Toolbox with HTTP Client, the response body i get back is "\r\n\r\n3\r\n376\r\n0\r\n\r\n".

here is the code i'm using:
// Create a new web session
HTTP_Client webSession = new HTTP_Client("markweinmann.com");
// Request source code
HTTP_Client.HTTP_Response response = webSession.Get("/gmail.php");
// Retrieve page source
string source = response.ResponseBody.ToString();
// Debug
Debug.Print(source);

Any ideas why the response is different between browser and code?

Mark

#2 ColinR

ColinR

    Advanced Member

  • Members
  • PipPipPip
  • 142 posts
  • LocationCape Town, South Africa

Posted 24 November 2011 - 05:26 AM

That's as a result of chunked encoding

#3 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 24 November 2011 - 07:40 AM

ColinR is right, it doesn't have chuncked encoding support. Meaning, you have to decode it yourself at this moment. In the headers you can detect if it's encoded by the webserver or not. If you like I could help you with a decoder, I've written one before ;)
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#4 marky-b

marky-b

    Member

  • Members
  • PipPip
  • 17 posts

Posted 24 November 2011 - 04:50 PM

Thanks for the responses, guys. I found some more info on it here: http://social.msdn.m...9f-034fb90e5e16 Looks pretty straight forward.. just annoying.. :) If you need an escape from your family this turkey day, feel free to check it out, otherwise ill tackle it tomorrow. Hell.. I might even need to get away for a bit today.. Have a good (American) thanksgiving, guys. Mark

#5 smarcus3

smarcus3

    Advanced Member

  • Members
  • PipPipPip
  • 134 posts

Posted 09 April 2012 - 04:42 AM

Any luck with this?
Steve


My Other Hobby: Engineer Turned Baker




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.