Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: HTTPGet()

$
0
0
Re: HTTPGet()
Web Connection
Re: HTTPGet()
Mar. 7, 2013
04:54 pm
3QD1089QFShow this entire thread in new window
Gratar Image based on email address
From:Rick Strahl
To:jroehl

Are you including wconnect.h and are you sure that wconnect.h is in your FoxPro path?

+++ Rick ---



cUserAgent = "West Wind Internet Protocols " + TRANSFORM(WWVERSION_NUMBER)

Returns:

Variable WWVERSION_NUMBER is not found.

Here's the code you should be using:


#INCLUDE wconnect.h*** Load the wwHttp and dependent librariesDO wwhttpLOCAL loHttp as wwhttp loHttp = CREATEOBJECT("wwHttp") loHttp.nHttpServiceFlags = loHttp.nHttpServiceFlags + INTERNET_FLAG_NO_COOKIES lcHtml = loHttp.HttpGet("http://store.west-wind.com") ? loHttp.cHttpHeaders

When you run this you should see a Set-Cookie header on every request. If you take the cookie flag out of the code, only the first hit will show the cookie because the cookie is set.

+++ Rick ---

<div>
So, this would be implemented like this?

Release o, site1 o = Createobject('wwIPStuff') o.nHttpServiceFlags = o.nHttpServiceFlags + INTERNET_FLAG_NO_COOKIES site1 = o.HTTPGet('http://www.somewebsite.com')

When I do this I get:

Property nHttpServiceFlags is not found.

Yes by default, HttpGet() retrieves cookie informaton and stores it in the standards Windows cookie store. It behaves in the same way as a browser in that it gets the cookie and expires it based on the cookie policy. Same store that Internet Explorer uses.

You can turn automatic cookie handling off, but this might actually make your application fail. Many sites that use cookies use them to keep track of users for subsequent requests or logins. If you are hitting more than a single link most likely you need the cookies.

You can turn cookies off with:

loHttp.nHttpServiceFlags = loHttp.nHttpServiceFlags + INTERNET_FLAG_NO_COOKIES

+++ Rick ---


Using HTTPGet(), can the website I am retrieving set a cookie on my hardrive?

If so, can the website read the cookie?

If so, where is the cookie?

Is there anyway of preventing cookies?

Thanks
Jeff

No, but wwHttp only retrieves the content - it doesn't run it, so it's not the job of the HTTP client to clean up your HTML.

If you're going to display HTML retrieved, you'll have to strip out script and a host of other things to sanitize the code - it's not a trivial job BTW, even though at first it might seem so because there are lots of potential attack vectors.

+++ Rick ---



With HTTPGet() is there anyway to disable javascript.

To tell the website I am getting that my browser has javascript disabled?

Thanks

Jeff












Rick Strahl
West Wind Technologies


from Maui, Hawaii

Making waves on the Web


Viewing all articles
Browse latest Browse all 10393

Trending Articles