-
November 18th, 2010, 09:20 PM
#1
-
November 18th, 2010, 09:32 PM
#2
Re: HttpWebRequest
by the way, if I try mineReq.ProtocolVersion = HttpVersion.Version11 it will throw an exception-> The server committed a protocol violation. Section=ResponseStatusLine
-
December 8th, 2010, 12:32 PM
#3
Re: HttpWebRequest
you sample code is incomplete and it cannot be tested (the HttpUtility is missing). I also get a "The remote server returned an error: (401) Unauthorized." exception. isn't your firewall blocking your app?
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
December 8th, 2010, 03:57 PM
#4
Re: HttpWebRequest
the code is not incomplete. you need to add web ref to your Visual Studio project to make HttpUtulity work. "using System.Web" is not enough.
and no, my firewall setting is fine.
if you get that error, that means the code runs fine you, that's great!
did you try to enter a valid username and a valid remote key of friendfeed?
will you do that and tell me the results?
thanks in advance
-
December 8th, 2010, 04:09 PM
#5
Re: HttpWebRequest
Originally Posted by nutrione
the code is not incomplete. you need to add web ref to your Visual Studio project to make HttpUtulity work. "using System.Web" is not enough.
and you are not about to tell me what I should add?
Originally Posted by nutrione
did you try to enter a valid username and a valid remote key of friendfeed?
where do I find a valid user and pass?
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
December 8th, 2010, 04:28 PM
#6
Re: HttpWebRequest
dude! I just told you
open up your Visual Studio project, go to solution explorer, right click on refference folder, click on "Add Refference", when a window appears, on ".NET" tab, search for "System.Web" and select it and click on ok, you're done.
what do you mean where? Friendfeed.com. go there, register, find your Remote Key (after you login, visit friendfeed.com/remotekey) and enter them in the code above on line 5: ("Username", "FFRemoteKey")
**Remenber your Remote Key is a private thing! like a password. don't post it here.
then run the project, and see what heppens. if you don't get any errors, check your friendfeed account to see that the text "Hello API" is posted on your feed or not.
Last edited by nutrione; December 8th, 2010 at 04:32 PM.
-
December 9th, 2010, 02:15 AM
#7
Re: HttpWebRequest
Originally Posted by nutrione
dude! I just told you
open up your Visual Studio project, go to solution explorer, right click on refference folder, click on "Add Refference", when a window appears, on ".NET" tab, search for "System.Web" and select it and click on ok, you're done.
sure, I already tried it but I don't see any System.Web dll to add. I added a using System.Web but VS still does not recognize HttpUtility and even IntelliSense does not see it even though it's there according to msdn
Originally Posted by nutrione
what do you mean where? Friendfeed.com. go there, register, find your Remote Key (after you login, visit friendfeed.com/remotekey) and enter them in the code above on line 5: ("Username", "FFRemoteKey")
**Remenber your Remote Key is a private thing! like a password. don't post it here.
ok, I'll try it later. I just thought friendfeed is some of your projects and did not do further research
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
December 10th, 2010, 04:14 PM
#8
Re: HttpWebRequest
someone will laugh... but I don't know what the password is. could it be my facebook pass when I registered with my facebook account?
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
December 10th, 2010, 08:26 PM
#9
Re: HttpWebRequest
Hi!
Oh no laughs. friendfeed can be a little confusing. click on settings on the right side of your avatar, on settings window, click on change password, enter something and save it. once more, go to settings, and enter a username for your account and save. now you have a username and a password to login with, directly to FF.
Do a login, visit friendfeed.com/remotekey and get your Remote Key. then enter your username and key in the code above. and run the code. then go back to your FF account to see if "Hello API" is posted there.
Thanks mate
Last edited by nutrione; December 10th, 2010 at 08:29 PM.
-
December 10th, 2010, 10:54 PM
#10
Re: HttpWebRequest
Hope you aren't harvesting credentials...
-
December 11th, 2010, 04:01 AM
#11
Re: HttpWebRequest
Originally Posted by dglienna
Hope you aren't harvesting credentials...
I don't think so, though my first thought was exacly the same but then I read that wikipedia states that friendfeed is owned by facebook. besides I use fake accounts anyway
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
December 11th, 2010, 07:17 AM
#12
Re: HttpWebRequest
Originally Posted by dglienna
Hope you aren't harvesting credentials...
are you serous?! WOW!
dude, look at the first post. does it look like someone trying to "harvest credentials"?
if he was familiar with all this FF thing, I would never type such long instructions just to setup and run a FF account!
and yes, FF is owned by facebook.
first no one answers, then when someone is trying to help....uh.
@memeloo thanks buddy. I still get Error 404: Not Found. I can create an account and provide the Uname and Key for you, so you can test this, is that Ok? I don't wanna cause any troubles.
P.S. @dglienna you know, I'm thinking how can I "harvest credentials", while I don't own the FF or anything that can lead memeloo's account details to me. where did you get the Idea?
Last edited by nutrione; December 11th, 2010 at 07:21 AM.
-
December 11th, 2010, 08:13 AM
#13
Re: HttpWebRequest
ok, I did like you said. then I moved the "entry?" part to post data like this:
Code:
HttpWebRequest mineReq = (HttpWebRequest)WebRequest.Create("https://friendfeed-api.com/v2/");
...
String postData = "entry?body=Hello API&format=xml";
...
and got the 403 authentication error. I'll look at it agian later, now I must go. should you figure it out in the meantime please let me know. I'm anxious how it works
(I also changed http to https which I prefer)
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
December 11th, 2010, 08:54 AM
#14
Re: HttpWebRequest
the URL should be "https://friendfeed-api.com/v2/entry" because you are going to post an entry. for other things like posting a comment there is https://friendfeed-api.com/v2/comment and so on (you can find these URLs at http://friendfeed.com/api/documentation) so don't change the URL. it also has a format=xml becasue FF uses Json by default, but I'm going to use XML therefore I have to add this parameter.
If you take a look at FF API Documentation, you'll see what's going on. and right now there is a problem with the API. this https://friendfeed-api.com/v2/entry?body=Hi&format=xml should post an entry. but FF returns an "ID required" error. according to the documentation, posting an entry does NOT require an ID. you can try that in your browser, it will ask you for your username and remoteKey.
Also take a look at http://friendfeed.com/static/html/apitest.html it shows API usage in action.
I don't know what's going on with FF API. they are changing some things. recently they just managed to fix the search feature. I think that's why the API acts odd!
why anxious?! we are trying to talk to the Friendfedd API via a HttpWebRequest and we're not using OAuth, but we're using HTTP Basic Authentication. that's the main Idea. I mentioned it all in the first post why I'm not using OAuth? (I know its safer) because this is gonna be a mobile application, not a web (browser) app. since OAuth needs browser, I use remoteKey which Friendfeed provided for this use. it's a feature of FF. I don't know why you're anxious about it. but I think you don't have a similar programming experience. that's why this all looks Suspicious to you!!!! But after all, Friendfeed API Documentation is there. explains everything, I hope.
P.S. If you're not comfortable with this, just drop it and let go. just don't do it. I appreciate your work and time you have spent.
I feel like I talk too much sorry, but I felt it was Necessary.
Last edited by nutrione; December 11th, 2010 at 09:12 AM.
-
December 11th, 2010, 12:17 PM
#15
Re: HttpWebRequest
interestingly it works when you put all the parameters in the call to Create the instance of HttpWebRequest like this:
Code:
HttpWebRequest httpWebRequest =
(HttpWebRequest)WebRequest.Create("http://friendfeed-api.com/v2/entry?body=Hello API&format=xml");
and skips the line
Code:
Stream dataStream = httpWebRequest.GetRequestStream();
"Hallo API" was successfuly added to my feed
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|