HTTP post returns same response for prowl notification

An iPhone client for Growl available on the App Store.
btv
Harmless
Posts: 2
Joined: Fri Apr 20, 2012 7:10 pm

HTTP post returns same response for prowl notification

Postby btv » Fri Apr 20, 2012 7:23 pm

I have written a vb app that uses the prowl API. I have run into an issue if i try to open the same URL to send a notification. I seem to get the same responseText where i believe it should be different. Also, if i request the same url, the second one doesn't go through. If i request the URL, close my application then reopen i am able to send the same URL request as i just did with the previous instance of the application. If I try to send the same one it doesn't go through and i have noticed that my response is the same meaning that the timestamp and remaining stays the same. If i change one part of the URL that i am opening, then it works fine.

I'm sort of new to programming and i'm new to prowl so i was wondering if someone would be able to help me understand if there is a limitation in my code, something i am not doing correctly, or a limitation with prowl. I googled and searched the forum beforehand and couldn't find anything on this.

Thank you


section of code that sends the request:



oHTTP = CreateObject("Microsoft.XMLHTTP")
'Send Http Post

HTTPRequestURL = "https://api.prowlapp.com/publicapi/add?" & _
"apikey=" & PostAPIKey & _
"&priority=" & PostPriority & _
"&url=" & PostURL & _
"&application=" & PostApplication & _
"&event=" & PostEvent & _
"&description=" & PostDescription & _
"%0A"
oHTTP.Open("Get", HTTPRequestURL, False)
oHTTP.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
oHTTP.Send()
HTTPPost = oHTTP.responseText

User avatar
zac
Cocoaforge Admin
Posts: 1518
Joined: Sun Mar 27, 2005 3:19 pm
Contact:

Re: HTTP post returns same response for prowl notification

Postby zac » Fri Apr 20, 2012 8:10 pm

Sounds like the response is being cached. You can either convert the call to an HTTP POST instead of GET, which won't be cached, or try to disable caching in your HTTP library.

btv
Harmless
Posts: 2
Joined: Fri Apr 20, 2012 7:10 pm

Re: HTTP post returns same response for prowl notification

Postby btv » Sat Apr 21, 2012 12:20 pm

Thank you, Zac.

I tried changing this line:

oHTTP.Open("GET", HTTPRequestURL, False)

To this:
oHTTP.Open("POST", HTTPRequestURL, False)

That resolved the problem. I looked into the other solution you suggested and once i knew (from you) what was going on, i searched it on the web. Looks like with some sites you can toss in a timestamp that can be ignored to get the url to be unique each time. The first one you suggested was the simplest so that's the one i'm going with.

Thanks


Return to “Prowl”

Who is online

Users browsing this forum: Yahoo [Bot]