[twitter-dev] Re: How-To: Load the Twitter XML into a VB.Net XML Document...

2009-07-01 Thread Obrzut

Did I state otherwise?

You are not reading my words - you are being blinded by the noise from
your own head.

What I stated is this;

I authenticate my VB.NET web browser via PIN etc

THIS means my browser is authenticated.

If I try to access a page via the program with a TCP Client - I have
to re-authenticate via PIN.

This WAS a problem - my solution is to continue to use the web browser
for authentication and extract the XML pages into an XML Document.

Hence the above code.

If you state otherwise - that you CAN use a TCP Client after already
authenticating your VB.Net web browser - you are wrong.

I imagine you think I am wrong - and that I am an idiot. Believe me -
I am very skilled at programming. And this is my experience.

The library is faulty. It does not process leading zero pins.

The OAuth implementation is stupid - because it does not authenticate
an program but a TCP method.

Hence, you guys are s off the mark here it hurts me to talk to
you.

Really, srsly, it's pathetic that you DO NOT LISTEN.

On Jul 1, 4:58 am, DWRoelands  wrote:
> You can absolutely authenticate in a web page, even if your
> application is not a web application.  Mine works that way.
>
> Here's how it should go.  Bojan, please correct me if I'm wrong.
>
> 1. Your application calls GetAuthorizationLink() to get the URL of the
> authorization page (you've got this already).
> 2. Your application opens a web browser to that link.  In .NET, you
> can do this with Process.Start(The URL that you get from
> GetAuthorizationLink).
> 3. The user sees the six-digit PIN on the screen.
> 4. Your application prompts the user to enter the six-digit PIN that
> they see.
> 5. Your application calls GetAccessToken(), passing the six-digit PIN
> as the input parameter.
> 6. The OAuth object has two properties that should now be populated:
> Token and TokenSecret.  These are the items you will use for all
> subsequent OAuth requests to Twitter.
>
> Your application should now be authorized via OAuth.
>
> On Jun 30, 8:58 pm, Obrzut  wrote:
>
>
>
> > This is because of OAuth. It uses HTML pages to validate. Perhaps I am
> > wrong - but once I use a web browser to validate - I cannot use a TCP
> > Client to get the XML because I authenticated via a web browser. When
> > I tried to (for example) send the pin back via a HTTP Web Request it
> > failed. I am not sure if I am using the OAuth library Interface Class
> > I have for VB.NET correctly!?


[twitter-dev] Re: How-To: Load the Twitter XML into a VB.Net XML Document...

2009-07-01 Thread Obrzut

Right - I am not scraping the PIN? I am using the web browser in .NET
(which is similar to Internet Explorer)

to authenticate via a pin and username / password credentials.

The only part of the workflow I do not follow is opening the URL in IE
- I open in it VB.NET Web Browser.

But - my user has to input it to send it back - I do not retreive it.

What I am retreiving is the XML document that is sent to the web
browser.

I am not sure if any of you have actually seen the pages yet - but I
have a few problems with your Library.

When the pin starts with a zero - the authentication fails. Are you
converting the pin string to an integer in your library? This is the
only reason why a leading zero would be stripped you see.

That is my first problem with the library - it has not been tested in
a real world example otherwise this would have been flagged long ago.

Now - I am not sure why you would think I was scraping the PIN - my
user inputs it into a VB textbox for sending back to the correct URL.
This way - my web browser gets authenticated.

Also, did you know a Login prompt appears from the browser window -
asking the user for Login credentials a SECOND time!?

This is most peculiar. Have anyone else experienced this or are
basically just not experienced in writing for the Twitter API and just
read the information pages.

I am a programmer - writing a VB.NET application that is registered
with Twitter. I require real world examples because my program is real
world - not from the pages of the Twitter API documentation.

So, lets make this clear divide here - I want to talk to programmers -
not just people who THINK they know what is happening from the API man
pages. lol


[twitter-dev] Re: How-To: Load the Twitter XML into a VB.Net XML Document...

2009-06-30 Thread Obrzut

What do you mean by screen scraping? Is it because I am taking the
HTML page and turning it into a XML document?

This is because of OAuth. It uses HTML pages to validate. Perhaps I am
wrong - but once I use a web browser to validate - I cannot use a TCP
Client to get the XML because I authenticated via a web browser. When
I tried to (for example) send the pin back via a HTTP Web Request it
failed. I am not sure if I am using the OAuth library Interface Class
I have for VB.NET correctly!?

But, the way I am doing it - I just keep a web browser open to make
the requests - and use the above code to filter off the XML.

I hope I am not breaking any rules? If Bojan R. wants to help me out
(he wrote the OAuth library I am using) then I'd much appreciate to do
it the *right* way.

On Jul 1, 12:27 am, DWRoelands  wrote:
> I'm curious; why are you screen-scraping an HTML page in a Twitter
> app?
>
> On Jun 30, 4:09 pm, Obrzut  wrote:
>
>
>
> > Dim w As New System.IO.StreamWriter(fs)
> >             Page = Page.Replace("&", " ")
> >             Page = Page.Replace("- <", "<")
>
> >             Page = Page.TrimStart(" ")
> >             w.Write(Page)
>
> > This is a better example of code that does what the above code sample
> > should be doing rather than changing UTF8 to ASCII - I replace a '- <'
> > with a '<' remove any '&'s and trim the white space. This makes it
> > sorted for VB.Net whilst preserving most the document text.


[twitter-dev] Re: How-To: Load the Twitter XML into a VB.Net XML Document...

2009-06-30 Thread Obrzut

Dim w As New System.IO.StreamWriter(fs)
Page = Page.Replace("&", " ")
Page = Page.Replace("- <", "<")

Page = Page.TrimStart(" ")
w.Write(Page)

This is a better example of code that does what the above code sample
should be doing rather than changing UTF8 to ASCII - I replace a '- <'
with a '<' remove any '&'s and trim the white space. This makes it
sorted for VB.Net whilst preserving most the document text.


[twitter-dev] Re: How-To: Load the Twitter XML into a VB.Net XML Document...

2009-06-30 Thread Obrzut

OMG! What a mistake! VB.NET does not support UTF8 encoding - BUT -
that is because I was removing the - from UTF-8!

Haha. What a silly mistake on my part!

When I fixed it - UTF-8 works just fine in Visual Basic .Net! My code
was at fault.

But, the rest still stands - you have to remove the white space from
the beginning of the document

AND

Remove the - from the rest of the document apart from UTF-8! Haha.

Sorted it now.


[twitter-dev] How-To: Load the Twitter XML into a VB.Net XML Document...

2009-06-30 Thread Obrzut

Dim Page As String = WebBrowser1.Document.Body.OuterText
If System.IO.File.Exists("C:\temp.txt") = True Then
System.IO.File.Delete("C:\temp.txt")
End If
Dim fs As New System.IO.FileStream("C:\temp.txt",
IO.FileMode.CreateNew)
Dim w As New System.IO.StreamWriter(fs)
Page = Page.Replace("-", "")
Page = Page.Replace("UTF8", "ASCII")
Page = Page.Replace("UTF-8", "ASCII")
Page = Page.Replace("&", " ")
Page = Page.TrimStart(" ")
w.Write(Page)

w.Close()
fs.Close()

---

This is a code snippet I took from my test program. It uses OAuth to
authenticate. But this snippet is not about OAuth! These are the
things you are required to do before you can issue an XML.DOC.LOAD()
call.

So, you have dimmed xml as a new system.xml.document

Now, you want to call xml.load(WebBrowser1.DocumentText)

Forget it!

You are required to format the Twitter XML Web Page BEFORE loading it
into an XML Document in VB.NET.

Firstly, there is white space at the beginning of the document that
needs removing.

Secondly, you have to replace every - and & otherwise it will fail to
load! (Definitely the & not so much the - )

Thirdly, you are required to reformat the document from UTF8 to ASCII.
The XML.Load() call in VB.NET DOES NOT SUPPORT UTF8 ENCODING! I
cannot stress this enough :)

No, I am not shouting - I am using caps as a replacement for italics!
Haha.

So, after all this, the document C:\temp.txt can be used to load in
your XML.load("C:\temp.txt") document. But, there are other issues -
such as deleting the file before updating (re-writing the new document
with updates) then re-loading the new file into the XML parser in
VB.NET. These are all issues I hope you can solve yourself. This post
is specific to formatting the Twitter XML to adhere to VB.NET
standards.

Obrzut


[twitter-dev] Re: PIN Authentication Examples?

2009-06-30 Thread Obrzut

Hi,

Well, my experience of using a web browser in VB.Net is that you have
to keep to the same browser and cannot mix a HTTPWebRequest with a
WebBrowser1 object!

What I tried was getting the pin number via a web browser object, then
sending that back via a HTTPWebRequest class. It failed miserably.
Perhaps it was my code?

I too am writing a VB.NET program for Twitter! It is very exciting
work. I would have finished it last week but I had a whole week off
coding because of the flu.

What I have left to do is parse all the XML into my program correctly.
Also, just a quick note - the XML.document.load in VB.NET does NOT
accept UTF-8 as an encoding method - so I suggest reformatting the XML
document as ASCII before trying to load it. ALSO - remove any white
space (there are about three spaces at the beginning of the document!)
otherwise VB.NET throws its toys out the pram.

There are a few other issues too with XML documents and Twitter - such
as the '&' character being illegal. You have to replace every & with a
non-space if you want your document to load! Other than that - I
finally got my document into a VB.NET XML Document and now parsing the
XML is easy-peasy. This is because all you have to do is specify which
node name you want to retrieve - and VB.NEt does all the work! Haha.

I am really tired today - but I might work on the VB.NET program some
more later on after I finish my nap :)


[twitter-dev] Re: How-To: Get a Twitter Token via VB.NET

2009-06-27 Thread Obrzut

Thanks. I really needed to know the license because I am using a
creative-commons license for my Open Source program.

Your library really is the bomb! At first, I thought you had to input
the pin on EVERY request made by the program - but that is not true
thankfully :)

Also, I will give you full credit in the credits of the program - and
in the README supplied with it.

Would you like me to link to any website of yours?

Oh, and the program is coming along at a fair pace. The first version
for release should be completed within seven days!

The only thing stopping me coding right now is that I have the flu :(

Thanks again for such an excellent implementation of OAuth.

Obrzut

On Jun 27, 4:45 am, Bojan Rajkovic  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
>
>
>
>
> Obrzut wrote:
> > Hi,
>
> > Yes, I copied the sample exactly - but I did not see the part where I
> > had to copy the URL to a browser to get the pin.
>
> > But, I have used your library to much success! It is amazing! I can
> > now login to twitter using OAuth!
>
> > Can you please tell me the following;
>
> > 1. What license have you used for your code? (BSD, GPL ???)
>
> > 2. Do you require crediting in any way if I were to use your code in
> > my application for release?
>
> > 3. I am writing an Open Source application - can I use your code in it
> > without having to pay royalties?
>
> > Please answer these questions - as my application relies heavily on
> > your OAuth.Twitter.DLL
>
> > Kind regards,
>
> > Obrzut
>
> > On Jun 26, 5:18 pm, Bojan Rajkovic  wrote:
>
> > Obrzut wrote:
> > >>> Well, I only copied your sample code to the letter?
> > >>> It is not my intention to use your API incorrectly.
> > >>> I have a pounding headache this morning so all Twitter API
> > >>> development is at a halt.:(
> > >>> Kind regards,
> > >>> Obrzut
> > >>> On Jun 26, 1:25 am, Bojan Rajkovic  wrote:
> > >>> Obrzut wrote:
> > >>>>>> Hello, Sadly, your API does not work. :( odule Module1 Sub
> > >>>>>> Main() Dim pin As Integer = 0 Dim OAuth As New
> > >>>>>> OAuth.Twitter("Key","Secret") OAuth.Debugging = True Dim URL
> > >>>>>> As String = OAuth.GetAuthorizationLink() Dim pinRead As
> > >>>>>> String = String.Empty While Not
> > >>>>>> (System.Int16.TryParse(pinRead, pin)) Console.WriteLine("Type
> > >>>>>> in the PIN provided by Twitter and press Enter/Return.")
> > >>>>>> Console.WriteLine(pinRead) pinRead = Console.ReadLine() End
> > >>>>>> While If OAuth.GetAccessToken(pin) Then URL =
> > >>>>>> "http://twitter.com/account/verify_credentials.xml"; Dim Xml
> > >>>>>> As String = (OAuth.WebRequest
> > >>>>>> (Global.OAuth.RequestMethod.GET, URL, String.Empty))
> > >>>>>> Console.WriteLine(Xml) End If End Sub End Module
> > >>>>>> 
> > >>>>>> This is my code - using your API. But, no pin appears - why?
> > >>>>>> It fails on the pin number.
> > >>> You're using the API wrong. You have to open the webpage provided
> > >>> by GetAuthorizationLink (), and get the PIN from there. I won't
> > >>> parse the page that Twitter sends back with the PIN.
> > You clearly did not copy the entire sample--I just checked the sample,
> > and there's a part where the URL is written to the console, and you
> > are asked to open the URL and get the pin. Please check the sample
> > again, make sure you are using it exactly.
>
> The library is licensed under the MIT license, so it is free and open
> source software. :) You are welcome to it under the terms of the MIT
> license, whose entire text you can read in the headers in each file.
> Enjoy the library, I'm glad you can put it to good use!
>
> Cheers,
> Bojan
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org
>
> iQIcBAEBAgAGBQJKRZXkAAoJEO4IwQyHg9AWahwP/3vODIvc7SqV/dWRic1lFxtW
> 8hhBDbka+eQINw5IQXdKNvxzYSu9aXshLN0SnM/GHkCoALabhrgshN0Nf3BZSdjD
> QGNrqu1gX5+zYlSjkTjom9fpaPcaulZNsoc+ELSBrwdK+WfaVQcZ/0MgGQi6MGX0
> KW6/Wx+iuvL2OOdjYEKSja5soSACBi1IFR2YkbonlHLtJqWVdSGFT8P0gAOwFYSv
> OGq0VtaiF8FQ/gsSTp/pLP+MCDIxEAukqTs2PUT1jfqrKHRUChwropVjDG0Shplz
> QJ+FyLRYn+dNkUnpH6Qx8EhBzP649QXB8ofnswfl139aC5jULDzqytP79u6ROqKo
> yrBLPWrv6ZQkS0Wv35EMzJaaJnXW2F+dMPBrsQn7bbjnORd2TUtZvkyyf7YXKc8t
> JLGqB0eLdyqQFToIdX7qmhcv3M6cVmeWl0yFvPYQDrDHwiiM2CLHqyHwnjHm8sD5
> dwRiscyjdPRm7I3d7LYwNAfvGRLW7TMTJZbGaAeLXfP9Ze84TIbIXc4iN1t8dBsa
> enmvt7Jjgu36b+U4YjhcvlidRUEP2VYcijU8WHbMGKM416Vu7Uli+xhkC+vny3UV
> uZkKDcjMV4YvPF8lt3VsAA14T0QpgkPK+rswsI33LZbKBLxrk4T4EsVxxjc78Bh/
> Td/ewEXbnXIrC6Tn1RTE
> =zZy1
> -END PGP SIGNATURE-


[twitter-dev] Re: How-To: Get a Twitter Token via VB.NET

2009-06-26 Thread Obrzut

Hi,

Yes, I copied the sample exactly - but I did not see the part where I
had to copy the URL to a browser to get the pin.

But, I have used your library to much success! It is amazing! I can
now login to twitter using OAuth!

Can you please tell me the following;

1. What license have you used for your code? (BSD, GPL ???)

2. Do you require crediting in any way if I were to use your code in
my application for release?

3. I am writing an Open Source application - can I use your code in it
without having to pay royalties?

Please answer these questions - as my application relies heavily on
your OAuth.Twitter.DLL

Kind regards,

Obrzut

On Jun 26, 5:18 pm, Bojan Rajkovic  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
>
>
>
>
> Obrzut wrote:
> > Well, I only copied your sample code to the letter?
>
> > It is not my intention to use your API incorrectly.
>
> > I have a pounding headache this morning so all Twitter API
> > development is at a halt.:(
>
> > Kind regards,
>
> > Obrzut
>
> > On Jun 26, 1:25 am, Bojan Rajkovic  wrote:
>
> > Obrzut wrote:
> >>>> Hello, Sadly, your API does not work. :( odule Module1 Sub
> >>>> Main() Dim pin As Integer = 0 Dim OAuth As New
> >>>> OAuth.Twitter("Key","Secret") OAuth.Debugging = True Dim URL
> >>>> As String = OAuth.GetAuthorizationLink() Dim pinRead As
> >>>> String = String.Empty While Not
> >>>> (System.Int16.TryParse(pinRead, pin)) Console.WriteLine("Type
> >>>> in the PIN provided by Twitter and press Enter/Return.")
> >>>> Console.WriteLine(pinRead) pinRead = Console.ReadLine() End
> >>>> While If OAuth.GetAccessToken(pin) Then URL =
> >>>> "http://twitter.com/account/verify_credentials.xml"; Dim Xml
> >>>> As String = (OAuth.WebRequest
> >>>> (Global.OAuth.RequestMethod.GET, URL, String.Empty))
> >>>> Console.WriteLine(Xml) End If End Sub End Module
> >>>> 
> >>>> This is my code - using your API. But, no pin appears - why?
> >>>> It fails on the pin number.
> > You're using the API wrong. You have to open the webpage provided
> > by GetAuthorizationLink (), and get the PIN from there. I won't
> > parse the page that Twitter sends back with the PIN.
>
> You clearly did not copy the entire sample--I just checked the sample,
> and there's a part where the URL is written to the console, and you
> are asked to open the URL and get the pin. Please check the sample
> again, make sure you are using it exactly.
>
> - --
> Bojan Rajkovic 
> Biochemistry '10, Brandeis University
> PGP Signature Key ID: 0x8783D016
> PGP Encryption Key ID: 0x2497B8B2
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org
>
> iQIcBAEBAgAGBQJKRPTpAAoJEO4IwQyHg9AWuUwQAJkeeSu5+X4aYtkHvwKYDmtP
> jhU20FoLUi51CRPuI0qg/SJvKyUVGp788oM6V1un49ax2zAnwiq9xOM4qTKqffpg
> x1l6d4tAVWplUe7BXDoL83Sf4xdxFfoBQ8me/v1r/kaoBdt4/hmVwZm/JBt9TDZs
> SXGWnmlcuF8zPTU3dlgsdTNeeVh/AXfrVOGkZWuGIwHW6Rfn6yJRFXy9lsCHc7FH
> cf0OKOClqOIdB/54eP39Ditt/Da/dnNsXbUgkLcGN2i6YC/TKx74CzJgxxoKDV/9
> hBgHQxDNAA3Vu3gxy/iR0PZDCkeqRvoqQmsP2Qm8CgPuEW3CnqXpT6ISFooqeZaI
> dbiaGiM3DjeOjm2wal2tULYfnRINusJI73YaLIULolVS/lvWJMSiqu58MFFRZPTS
> UqarwKeFBNFC6wZPu5+P9c8qtNjYtLE8FvqkkDc5cmt4sSSkz3B+EQMokohuLkR9
> GyfLPiSARew3VENbIwzL973Wlhgngj6p/yGqlXdU2XXJH+DMxjb7gX+53b3VSqpo
> N65NBlVm9zdB5CGZMK82n44S1+ClVSHQHw3cg32gUb0pS8b+WjfKxwr/CKn4tmll
> 77MPufL2RC9RsMqBbyTF++QgUpzlIJ4OOhh/3v1EiKv+YonznBW6RxiaIpHuZt7J
> KHNvBdUtLhtb635g5EkK
> =G9s/
> -END PGP SIGNATURE-


[twitter-dev] Re: How-To: Get a Twitter Token via VB.NET

2009-06-25 Thread Obrzut

Well, I only copied your sample code to the letter?

It is not my intention to use your API incorrectly.

I have a pounding headache this morning so all Twitter API development
is at a halt.:(

Kind regards,

Obrzut

On Jun 26, 1:25 am, Bojan Rajkovic  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
>
>
>
>
> Obrzut wrote:
> > Hello,
>
> > Sadly, your API does not work. :(
>
> > odule Module1
>
> > Sub Main()
>
> > Dim pin As Integer = 0 Dim OAuth As New
> > OAuth.Twitter("Key","Secret") OAuth.Debugging = True
>
> > Dim URL As String = OAuth.GetAuthorizationLink()
>
> > Dim pinRead As String = String.Empty While Not
> > (System.Int16.TryParse(pinRead, pin)) Console.WriteLine("Type in
> > the PIN provided by Twitter and press Enter/Return.")
> > Console.WriteLine(pinRead) pinRead = Console.ReadLine() End While
>
> > If OAuth.GetAccessToken(pin) Then URL =
> > "http://twitter.com/account/verify_credentials.xml"; Dim Xml As
> > String = (OAuth.WebRequest (Global.OAuth.RequestMethod.GET, URL,
> > String.Empty)) Console.WriteLine(Xml) End If End Sub
>
> > End Module
>
> > 
>
> > This is my code - using your API. But, no pin appears - why?
>
> > It fails on the pin number.
>
> You're using the API wrong. You have to open the webpage provided by
> GetAuthorizationLink (), and get the PIN from there. I won't parse the
> page that Twitter sends back with the PIN.
>
> - --
> Bojan Rajkovic 
> Biochemistry '10, Brandeis University
> PGP Signature Key ID: 0x8783D016
> PGP Encryption Key ID: 0x2497B8B2
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org
>
> iQIcBAEBAgAGBQJKRBWAAAoJEO4IwQyHg9AWfocP/ikGk7Mo4h49khsrkzYTUxOR
> 4POcmRSRObHDRTC7YZrvypH9NyfWgquYRj6W/Qkc5fvF8DWWyUcw3EnHBzfHjHKB
> aCSxqJPtTCtAgh7RjFCOjgZRJK+4xum7llq2DnBNnnNGzQPoSQdCI3eCOdkjF01K
> gH1mnnO4ofj/0rTDoCPyQzW2GLvUy4sMironwUX9fEyDo60f4J9LH2Cr6lAm4jRU
> tMJ8cfDPA6EToeallidFcc2reKeCvK0EAw2R0nAumwWH8DTk4egpHHrX34AeYCOW
> I/hJNgeaakZNvl8eJsuGCTlqGjkUuOSFgxNEQ1IgyPKCT2cZYz0fq8A7ricIb6kp
> 4s+aWFVLjSIYMAykHEna/AGkQygwv6otWOELiNjX+hGjrywNw3Q7cSbr0HASHZ58
> VFH3xDnrK7d4Qecr+brFJA92T2sBkUzHuxtLOOqLPdHMPAEQFjRpxDv6qcGsNOid
> qWdXDTXZGkQ+eVye0whTHdpZYOroWvMCM12dwPQcphtgO99Sl+bCUNqOPomAf0xZ
> uSqOZosEzaaoMo8WYeeRGkQ7u+8hvU3jYF6J1Fxd//kpozJSiv/yw/jgxToZSTHQ
> JD4R+7rwIr+rduGnTcL1Ad5BRU9GCb5kkcWxfAB0q0jwGWl3niAKvHYFttKRUTe2
> ubrdygwavcpBBDed/CVJ
> =IG+B
> -END PGP SIGNATURE-


[twitter-dev] Re: How-To: Get a Twitter Token via VB.NET

2009-06-25 Thread Obrzut

Hello,

Sadly, your API does not work. :(

odule Module1

Sub Main()

Dim pin As Integer = 0
Dim OAuth As New OAuth.Twitter("Key","Secret")
OAuth.Debugging = True

Dim URL As String = OAuth.GetAuthorizationLink()

Dim pinRead As String = String.Empty
While Not (System.Int16.TryParse(pinRead, pin))
Console.WriteLine("Type in the PIN provided by Twitter and
press Enter/Return.")
Console.WriteLine(pinRead)
pinRead = Console.ReadLine()
End While

If OAuth.GetAccessToken(pin) Then
URL = "http://twitter.com/account/verify_credentials.xml";
Dim Xml As String = (OAuth.WebRequest
(Global.OAuth.RequestMethod.GET, URL, String.Empty))
Console.WriteLine(Xml)
End If
End Sub

End Module



This is my code - using your API. But, no pin appears - why?

It fails on the pin number.


[twitter-dev] Re: How-To: Get a Twitter Token via VB.NET

2009-06-25 Thread Obrzut

Thanks. But - I kinda sorted it here with this code snippet...

url = "https://twitter.com/account/verify_credentials.xml";

Dim test As String = url

Dim UR As System.Net.WebRequest = System.Net.WebRequest.Create
(test)
UR.Credentials = New NetworkCredential("APONetworks",
"password")

Dim str As System.IO.Stream = UR.GetResponse
().GetResponseStream()

Dim r As New System.IO.StreamReader(str)

TextBox1.Text = r.ReadToEnd()

r.Close()
str.Close()


--

It now retreives the web page I request all the time! Haha! No need
for external DLLs or any sort of thing.

I am well pleased!

I guess it's a kinda cheat - but it works :)


[twitter-dev] Re: Desperate for Help! Twitter API Blues...

2009-06-25 Thread Obrzut

url = "https://twitter.com/account/verify_credentials.xml";

Dim test As String = url

Dim UR As System.Net.WebRequest = System.Net.WebRequest.Create
(test)
UR.Credentials = New NetworkCredential("APONetworks",
"")

Dim str As System.IO.Stream = UR.GetResponse
().GetResponseStream()

Dim r As New System.IO.StreamReader(str)

TextBox1.Text = r.ReadToEnd()

r.Close()
str.Close()



SUSSED IT!

Yeah - I cheated a lil bit - but I am now able to retrieve all the
data from the page and parse it into my textbox! Ha.

Now - I am making my first Twitter App!


[twitter-dev] How-To: Get a Twitter Token via VB.NET

2009-06-25 Thread Obrzut

Hi,

I have been working on an program that will eventually access the
Twitter site.

But, I have found the very first stage of OAuth very cumbersome.

Basically, I have the following code;

Dim url As String = "http://twitter.com/oauth/request_token";
Dim xml As String = ""
Dim OAuth As New OAuth_Twitter
Dim O As New OAuth.OAuthBase
Dim consumerKey As String = "CgZiTeNqGk2c0eZSdb9qg"
Dim consumerSecret As String =
"Sf7DGMTiK4cyU8qOuqOWX4yCNCwAdcRAlAj02cOA"
Dim token As String = ""
Dim tokenSecret As String = ""
Dim Method As String = "GET"
Dim outURL As String = "http://twitter.com/statuses/show/
123.xml"
Dim querystring = ""
Dim URI As New Uri(url)

Dim nonce As String = O.GenerateNonce()
Dim timeStamp As String = O.GenerateTimeStamp()

REM//Generate Signature
Dim sig As String = O.GenerateSignature(URI, _
consumerKey, _
consumerSecret, _
token, _
tokenSecret, _
Method, _
timeStamp, _
nonce, _
"", _
querystring)

querystring &= "&oauth_signature=" & HttpUtility.UrlEncode
(sig)

Dim test As String = url & "?" & querystring

Dim UR As System.Net.WebRequest = System.Net.WebRequest.Create
(test)

Dim str As System.IO.Stream = UR.GetResponse
().GetResponseStream()

-

The program fails at the end - where str is dimmed as a IO.Stream and
a GetResponseStream() is attempted.

I get a 401: Unauthorised message - and the program terminates.

I think I am doing some thing wrong here, but I do not know what?

Do I have to use GenerateSignature() from the OAuth class twice? How
about using GenerateBaseSignature()?

I am really confuzzled. Ha!

Does anyone here know anything about VB.NET and OAuth implementations
in this language?


[twitter-dev] Re: Desperate for Help! Twitter API Blues...

2009-06-25 Thread Obrzut

Public Function AuthorizationLinkGet()
Dim ret As String = Nothing

Dim response As String = OAuthWebRequest("GET", REQUEST_TOKEN,
String.Empty)

If (response.Length > 0) Then
REM response contains token and token secret.  We only
need the token.
Dim qs As NameValueCollection =
HttpUtility.ParseQueryString(response)
If (Not qs.Item("oauth_token") = Nothing) Then
ret = AUTHORISE & "?oauth_token=" & qs.Item
("oauth_token")
End If
End If
Return ret
End Function

---

This is the OAuthLinkGet function. It fails with an 401 :
Unauthorised!

This also calls the above offending function 'WebResponseGet' - as
part of 'OAuthWebRequest'.

As soon as WebResponseGet try to access the WebResponse - it gets a
401 Unauthorised.

So, it seems I need to to something with this part of the class.

Thanks - I really feel confident now that we have sussed out the
problems?


[twitter-dev] Re: Desperate for Help! Twitter API Blues...

2009-06-25 Thread Obrzut

Hi Matt,

There is an OAuthLinkGet routine in the OAuth_Twitter Class. I am not
sure if it is being used tho?

That said, the code in Form1 basically implements Twitter OAuth Class
- which in turn uses OAuth Class.

It is a heirarchy of classes :)

It should, really, be doing it properly because I only adopted the
classes to VB.NET and did not write them from scratch myself. AND I am
useing the official C# Base Class for OAuth - so it really should
work :(

But, I definitely think that is the problem - the nonces are not being
updated between requests.

But, when I update the nonces in the browser - I get a empty page? Is
that normal?

Perhaps some one here can help with the VB.Net side of things?


[twitter-dev] Re: Desperate for Help! Twitter API Blues...

2009-06-25 Thread Obrzut

Public Function WebResponseGet(ByVal web_Request As HttpWebRequest)


Dim responseReader As StreamReader = Nothing
Dim responseData As String = ""

Try

responseReader = New StreamReader
(web_Request.GetResponse.GetResponseStream())
responseData = responseReader.ReadToEnd()

Catch

Throw

Finally

web_Request.GetResponse().GetResponseStream().Close()
responseReader.Close()
responseReader = Nothing

End Try

Return responseData
End Function
-

This above is the final code for my VB.NET program.

I think because it is retreiving the same URL twice or even three
times - the nonce expires.

Any one got any solutions to this problem?


[twitter-dev] Re: Desperate for Help! Twitter API Blues...

2009-06-25 Thread Obrzut

Well, Hi again Matt.

Basically, it is hard to describe exactly what my app is doing because
it is using third party code.

Firstly, this is the URL I am trying to access;

url = "http://twitter.com/statuses/show/123.xml";


Then, here are the URL's for authentication that my API uses;

Public Const REQUEST_TOKEN As String = "http://twitter.com/oauth/
request_token"
Public Const AUTHORISE As String = "http://twitter.com/oauth/
authorize"
Public Const ACCESS_TOKEN As String = "http://twitter.com/oauth/
access_token"


I am using the C# Base Class with a VB.NET adapted C# Class to
interface with the C# Base Class for OAuth.

That is basically everything!

It generates a URL too. BUT - I just tried something:

I added http://:@twitter.com/etc...

To the URL that asks for the Login Prompt and also changed the Nonce.
I get a blank page then! Haha.

You see - when I clicked CANCEL on the Login prompt - I would get the
following output;


  /oauth/access_token?
oauth_version=1.0&oauth_nonce=9995405&oauth_timestamp=1245956104&oauth_signature_method=HMAC-
SHA1&oauth_consumer_key=CgZiTeNqGk2c0eZSdb9qg&oauth_signature=DaoiZKL5EMak1RyvTsGzYhlKe7Y
%3d
  Invalid / used nonce


You see - the Nonces have been used for some reason? I changed the
nonce from the original 6545405 to 9995405 and when I updated with a
new nonce I got the blank page. When I tried to access the source code
for you - I got the Login prompt again with the expired nonce.

SO

It seems the problem lies somewhere with updateing the nonces for each
request? AND/OR Supplying Login Credentials?

Perhaps this is what the 401 : Unauthorised error message from Visual
Studio means during a Web Request?

I will keep tinkering with the code by firstly adding my Twitter
Username and Password to the URL as above - but also try updateing the
nonce?

Any ideas on how to do this? I have posted my code in the initial
post.

On Jun 25, 7:41 pm, Matt Sanford  wrote:
> Hello again,
>
>      The access token URL [1] should be accessed by your application  
> to exchange a request token for an access token, not from a browser.  
> You're seeing a login dialog because that is what browsers do with  
> HTTP 401 (Unauthorized).  Your description has been a bit confusing,  
> is this the problem (excluding this browser thing):
>
> 1. Application gets a request token
> 2. Redirect the user to twitter.com/oauth/authorize … user clicks  
> through to accept
> 3. User returns to your site
> 4. Your site called twitter.com/oauth/access_token
> 5. BOOM: twitter.com/oauth/access_token returns 401
>
>      Is that the flow? If so, the body of the 401 would be most  
> helpful. If that is not the flow, please try and describe what you are  
> doing so I can try and reproduce the error and look for bugs on our  
> side.
>
> Thanks;
>   – Matt Sanford / @mzsanford
>       Twitter Dev
>
> [1] -http://twitter.com/oauth/access_token
>
> On Jun 25, 2009, at 11:33 AM, Obrzut wrote:
>
>
>
>
>
> > I have read that document. Like I said in my initial post - I have
> > read the tutorials and FAQs.
>
> > Furthermore - I have converted a C# Class that utilises OAuth C# Base
> > Class to VB.NET without a hitch.
>
> > It works just fine - the only problem is that it is reaching a Login
> > prompt that is asking for credentials that I do not have.
>
> > A. Williams - did you even read my last post? I find it highly
> > ignorant of you to refer me to the guide when I have successfully
> > authenticated the OAuth procedure.
>
> > That said, will anyone who cares to read my posts reply with some
> > thing that is relevant and makes sense?
>
> > I have given all the URL's needed - the parameters I am passing to
> > Twitters oauth page - and I am getting a LOGIN PROMPT.
>
> > Read my previous posts for more information.
>
> > Kind regards,
>
> > Obrzut
>
> > On Jun 25, 7:23 pm, Abraham Williams <4bra...@gmail.com> wrote:
> >> I would recommend readinghttp://oauth.net/documentation/getting-startedso
> >>  you have a thorough
> >> understanding of how Oauth.
>
> >> On Thu, Jun 25, 2009 at 12:17, Obrzut wrote:
>
> >>> WOW! Thanks! I'll try that!
>
> >>> Just a side note - I extracted the URL and ran it thru a web  
> >>> browser -
> >>> then it started popping open a Username / Password box?
>
> >>> It stated;
>
> >>> The server twitter.com at Twitter API requires a username and
> >>> password.
>
> >>> What is all this about? I ask, because, my twitter username and
> >>> password do not work?
>
> >>> 

[twitter-dev] Re: Desperate for Help! Twitter API Blues...

2009-06-25 Thread Obrzut

I have read that document. Like I said in my initial post - I have
read the tutorials and FAQs.

Furthermore - I have converted a C# Class that utilises OAuth C# Base
Class to VB.NET without a hitch.

It works just fine - the only problem is that it is reaching a Login
prompt that is asking for credentials that I do not have.

A. Williams - did you even read my last post? I find it highly
ignorant of you to refer me to the guide when I have successfully
authenticated the OAuth procedure.

That said, will anyone who cares to read my posts reply with some
thing that is relevant and makes sense?

I have given all the URL's needed - the parameters I am passing to
Twitters oauth page - and I am getting a LOGIN PROMPT.

Read my previous posts for more information.

Kind regards,

Obrzut

On Jun 25, 7:23 pm, Abraham Williams <4bra...@gmail.com> wrote:
> I would recommend readinghttp://oauth.net/documentation/getting-startedso you 
> have a thorough
> understanding of how Oauth.
>
>
>
>
>
> On Thu, Jun 25, 2009 at 12:17, Obrzut wrote:
>
> > WOW! Thanks! I'll try that!
>
> > Just a side note - I extracted the URL and ran it thru a web browser -
> > then it started popping open a Username / Password box?
>
> > It stated;
>
> > The server twitter.com at Twitter API requires a username and
> > password.
>
> > What is all this about? I ask, because, my twitter username and
> > password do not work?
>
> > When I ran the URL via the web browser object in VB.NET the document
> > completed without any body of text. It just exited without a login
> > prompt. Nothing.
>
> > So, it seems the URL I am creating seems sound - as it created a Login
> > prompt in google Chrome. But, I dunno what credentials I require for
> > the login prompt?
>
> >http://twitter.com/oauth/access_token?oauth_version=1.0&oauth_nonce=2...
>
> > This is the URL I used to access the login prompt.
>
> > Any pointers?
>
> > On Jun 25, 6:04 pm, Bojan Rajkovic  wrote:
> >> -BEGIN PGP SIGNED MESSAGE-
> >> Hash: SHA1
>
> >> Obrzut wrote:
> >> > "oauth_version=1.0&oauth_nonce=5048009&oauth_timestamp=1245948327&oauth_sig
> >> >  nature_method=HMAC-
> >> > SHA1&oauth_consumer_key=CgZiTeNqGk2c0eZSdb9qg&oauth_signature=vxFWk3JvGKdKI
> >> >  RYR31%2b2JC
> >> > %2bh30o%3d"
>
> >> > This is an example URL I am sending. Is there anything suspect you can
> >> > see just by looking at it?
>
> >> > It really would help me out no end.
>
> >> > Kind regards,
>
> >> > Obrzut
>
> >> You need to apply a lexicographical byte ordering to the OAuth
> >> parameters--that is, sort them alphabetically.
>
> >> I ran into this in the beginning, and scratched my head for a while
> >> until I read the OAuth standard.
>
> >> Cheers,
>
> >> - --
> >> Bojan Rajkovic 
> >> Biochemistry '10, Brandeis University
> >> PGP Signature Key ID: 0x8783D016
> >> PGP Encryption Key ID: 0x2497B8B2
> >> -BEGIN PGP SIGNATURE-
> >> Version: GnuPG v1.4.9 (GNU/Linux)
> >> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org
>
> >> iQIcBAEBAgAGBQJKQ647AAoJEO4IwQyHg9AWnVkP/2H5dQWnGSYXGGQV0YW6oswQ
> >> gBELIhWjHiq9lkQQbOrCUqV6hR4wycSa5hNfaW+YxQsVEuORTw1FAhiayJPRcVAH
> >> I8cgewOSgXG5CSbXfutPmfQFHZNdN3zgJMaS0sAwoyEik+nb/JePlUEkn7f9CPzb
> >> buqLAjadh0bLNdB/U2ld5FBgnAc1zQEJrGCePqfzYls3RTQm+dc6wtpzRnlKVDER
> >> hfsVh0E9OUZOIjEmaHsc7KUjoiATSB/j0LXrF+3x3BR/ISYkoLW0cJPQEscJVrG+
> >> JbtJ3Q4H1uJpDn5iF4ENhzjZa1/v45w/zliXk8MeDixLC4jtTUE54oKZsYFjhL/v
> >> d1BMgmgTVCJq7Qj2jJNKjD/A2nriAErh/i/42850MsF9JCnff6d2kruXccdHM8Lv
> >> ExttUH9k6c0U4SBVYjjv+Np4OOwWDJvwNx3mXW5mgfLsCtMKdSDD+mm4/M9MHDxR
> >> sHo54jlWDXGYHrbAJLtCBp02UN3FTlieQ61QYniaUJcZOuzMoKkmVn4/uHMJT7SQ
> >> u+DxUMYaFEpot72IOzgFmAmeToGw1GWyeBzeZnkPq5li5Y+EyUCVKH8dxSj4omM+
> >> qUHwvhI93cS6+mmh3L1KGsfg6uXl88xi1oP3d+k1N65nX4troGWE00VPROTbAPzk
> >> +UNJsrk9WkRuaif1le0b
> >> =M/IL
> >> -END PGP SIGNATURE-
>
> --
> Abraham Williams | Community Evangelist |http://web608.org
> Hacker |http://abrah.am|http://twitter.com/abraham
> Project |http://fireeagle.labs.poseurtech.com
> This email is: [ ] blogable [x] ask first [ ] private.


[twitter-dev] Re: Desperate for Help! Twitter API Blues...

2009-06-25 Thread Obrzut

WOW! Thanks! I'll try that!

Just a side note - I extracted the URL and ran it thru a web browser -
then it started popping open a Username / Password box?

It stated;

The server twitter.com at Twitter API requires a username and
password.

What is all this about? I ask, because, my twitter username and
password do not work?

When I ran the URL via the web browser object in VB.NET the document
completed without any body of text. It just exited without a login
prompt. Nothing.

So, it seems the URL I am creating seems sound - as it created a Login
prompt in google Chrome. But, I dunno what credentials I require for
the login prompt?

http://twitter.com/oauth/access_token?oauth_version=1.0&oauth_nonce=2475068&oauth_timestamp=1245949941&oauth_signature_method=HMAC-SHA1&oauth_consumer_key=CgZiTeNqGk2c0eZSdb9qg&oauth_signature=6Uq%2brP1nCHcS3WFLkPMtANO1Zso%3d

This is the URL I used to access the login prompt.

Any pointers?



On Jun 25, 6:04 pm, Bojan Rajkovic  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Obrzut wrote:
> > "oauth_version=1.0&oauth_nonce=5048009&oauth_timestamp=1245948327&oauth_sig 
> > nature_method=HMAC-
> > SHA1&oauth_consumer_key=CgZiTeNqGk2c0eZSdb9qg&oauth_signature=vxFWk3JvGKdKI 
> > RYR31%2b2JC
> > %2bh30o%3d"
>
> > This is an example URL I am sending. Is there anything suspect you can
> > see just by looking at it?
>
> > It really would help me out no end.
>
> > Kind regards,
>
> > Obrzut
>
> You need to apply a lexicographical byte ordering to the OAuth
> parameters--that is, sort them alphabetically.
>
> I ran into this in the beginning, and scratched my head for a while
> until I read the OAuth standard.
>
> Cheers,
>
> - --
> Bojan Rajkovic 
> Biochemistry '10, Brandeis University
> PGP Signature Key ID: 0x8783D016
> PGP Encryption Key ID: 0x2497B8B2
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org
>
> iQIcBAEBAgAGBQJKQ647AAoJEO4IwQyHg9AWnVkP/2H5dQWnGSYXGGQV0YW6oswQ
> gBELIhWjHiq9lkQQbOrCUqV6hR4wycSa5hNfaW+YxQsVEuORTw1FAhiayJPRcVAH
> I8cgewOSgXG5CSbXfutPmfQFHZNdN3zgJMaS0sAwoyEik+nb/JePlUEkn7f9CPzb
> buqLAjadh0bLNdB/U2ld5FBgnAc1zQEJrGCePqfzYls3RTQm+dc6wtpzRnlKVDER
> hfsVh0E9OUZOIjEmaHsc7KUjoiATSB/j0LXrF+3x3BR/ISYkoLW0cJPQEscJVrG+
> JbtJ3Q4H1uJpDn5iF4ENhzjZa1/v45w/zliXk8MeDixLC4jtTUE54oKZsYFjhL/v
> d1BMgmgTVCJq7Qj2jJNKjD/A2nriAErh/i/42850MsF9JCnff6d2kruXccdHM8Lv
> ExttUH9k6c0U4SBVYjjv+Np4OOwWDJvwNx3mXW5mgfLsCtMKdSDD+mm4/M9MHDxR
> sHo54jlWDXGYHrbAJLtCBp02UN3FTlieQ61QYniaUJcZOuzMoKkmVn4/uHMJT7SQ
> u+DxUMYaFEpot72IOzgFmAmeToGw1GWyeBzeZnkPq5li5Y+EyUCVKH8dxSj4omM+
> qUHwvhI93cS6+mmh3L1KGsfg6uXl88xi1oP3d+k1N65nX4troGWE00VPROTbAPzk
> +UNJsrk9WkRuaif1le0b
> =M/IL
> -END PGP SIGNATURE-


[twitter-dev] Re: Desperate for Help! Twitter API Blues...

2009-06-25 Thread Obrzut

Hi Matt,

I'm coding in Visual Studio 2005. I am using a HTTP REQUEST function
to make the request to the server.

This is basically all I get to go on is the error messages. I dunno
how to incorporate Charles into VB.NET?

Also, how do I go about printing out the body from VB.NET? If any one
else other than Matt would like to take a look at my code it really
would help.

Kind regards,

Obrzut

On Jun 25, 5:54 pm, Matt Sanford  wrote:
> Hi,
>
>      When you get an HTTP 401 there should be a body, Something like:  
> "Failed to validate oauth signature or token", or the more informative  
> "Invalid / expired token", or a host of other things. The "401  
> Unauthorized" is the HTTP status line itself and is the error we use  
> for all OAuth failures. If you're using a library to access Twitter  
> via OAuth perhaps it is not displaying the body message be default. If  
> that's the case I recommend adding some print statements, using a  
> debugging proxy (such as Charles), or watching via tcpdump (or  
> equivalent) so you can see the body.
>      Also helpful for debugging just about any error with the API is  
> the full request and response headers. Look at this from my  
> perspective … right now I have even less to go on than you. I don't  
> know your code, what request you made, and I cannot debug interactively.
>
> Thanks;
>    — Matt Sanford
>
> ProTip: When reporting bugs try to remember that no matter how  
> frustrated you are you're asking someone who is not sitting with you  
> and is not in the same frame of mind. This is like shouting at the  
> police when you called them. Therapeutic? yes. Helpful? probably not.  
> Good matrial for the show Cops? definitely.
>
> On Jun 25, 2009, at 9:45 AM, Obrzut wrote:
>
>
>
>
>
> > The remote server returned an error: (401) Unauthorized.
>
> > This is the exact error. I was not being hostile - just going out my
> > wits end! *smiles*
>
> > I've de-stressed by laying in bed for the past hour trying to forget
> > about the Twitter API and OAuth. Ha!
>
> > That said - shall I include the URL I am using with Parameters?
>
> > Perhaps that will help, no? I'll get right on that.


[twitter-dev] Re: Desperate for Help! Twitter API Blues...

2009-06-25 Thread Obrzut

"oauth_version=1.0&oauth_nonce=5048009&oauth_timestamp=1245948327&oauth_signature_method=HMAC-
SHA1&oauth_consumer_key=CgZiTeNqGk2c0eZSdb9qg&oauth_signature=vxFWk3JvGKdKIRYR31%2b2JC
%2bh30o%3d"

This is an example URL I am sending. Is there anything suspect you can
see just by looking at it?

It really would help me out no end.

Kind regards,

Obrzut


[twitter-dev] Re: Desperate for Help! Twitter API Blues...

2009-06-25 Thread Obrzut

The remote server returned an error: (401) Unauthorized.

This is the exact error. I was not being hostile - just going out my
wits end! *smiles*

I've de-stressed by laying in bed for the past hour trying to forget
about the Twitter API and OAuth. Ha!

That said - shall I include the URL I am using with Parameters?

Perhaps that will help, no? I'll get right on that.


[twitter-dev] Desperate for Help! Twitter API Blues...

2009-06-25 Thread Obrzut

Apologies for the double post. I was using the wrong google account
before.

http://www.aponetworks.com/dumpurge/index.html

Take a look at the source code here. PLEASE!

I keep getting an 401 unauthorised when I try to access anything on
twitter.

Please help - I've followed all the tutorials - this really should be
working and it is not...

Is there a time delay between when you reecive your application
tokens / secret to when they become active?

Kind regards,

Obrzut