From: Gary Miller on 16 Nov 2009 18:57 Can someone assist me with translating the below code to VO? Thanks. I'm not having much luck using the cHTTP class in VO to do a "Post" method. Gary string cRet; string cURL; string cParameters; System.Net.WebRequest req = System.Net.WebRequest.Create(cURL); req.ContentType = "application/x-www-form-urlencoded"; req.Method = "POST"; byte[] bytes = System.Text.Encoding.ASCII.GetBytes(cParameters) req.ContentLength = bytes.Length; System.IO.Stream os = req.GetRequestStream(); os.Write(bytes, 0, bytes.Length); os.Close(); System.Net.WebResponse resp = req.GetResponse(); if (resp == null) return; System.IO.StreamReader sr = new System.IO.StreamReader(resp.GetResponseStream()); cRet = sr.ReadToEnd().Trim(); return;
From: Karl Faller on 17 Nov 2009 02:25 Gary, go and get you http://www.voug-bodensee.net/Zip-Download/_GetOrPost.zip from Norbert Kolb - it simply works ;-) Karl >Can someone assist me with translating the below code to VO? > >Thanks. I'm not having much luck using the cHTTP class in VO to do a "Post" >method. > >Gary > >string cRet; > >string cURL; > >string cParameters; > >System.Net.WebRequest req = System.Net.WebRequest.Create(cURL); > >req.ContentType = "application/x-www-form-urlencoded"; > >req.Method = "POST"; > >byte[] bytes = System.Text.Encoding.ASCII.GetBytes(cParameters) > >req.ContentLength = bytes.Length; > >System.IO.Stream os = req.GetRequestStream(); > >os.Write(bytes, 0, bytes.Length); > >os.Close(); > >System.Net.WebResponse resp = req.GetResponse(); > >if (resp == null) return; > >System.IO.StreamReader sr = new >System.IO.StreamReader(resp.GetResponseStream()); > >cRet = sr.ReadToEnd().Trim(); > >return; >
From: Norbert Kolb on 17 Nov 2009 05:11 If you need special help send me an email. n dot kolb at aon dot at Norbert
From: Ginny Caughey on 17 Nov 2009 07:22 Gary, Do yourself a favor and learn how to wrap C# code to expose it via COM so you can just use it directly from VO. I just did sessions about this topic at VODC, and it really is as easy as 1-2-3. Calling the code from the VO side requires only 3 lines of code. -- Ginny Caughey www.wasteworks.com "Gary Miller" <gary(a)lucero.com> wrote in message news:5GlMm.35134$de6.4118(a)newsfe21.iad... > Can someone assist me with translating the below code to VO? > > Thanks. I'm not having much luck using the cHTTP class in VO to do a > "Post" method. > > Gary > > string cRet; > > string cURL; > > string cParameters; > > System.Net.WebRequest req = System.Net.WebRequest.Create(cURL); > > req.ContentType = "application/x-www-form-urlencoded"; > > req.Method = "POST"; > > byte[] bytes = System.Text.Encoding.ASCII.GetBytes(cParameters) > > req.ContentLength = bytes.Length; > > System.IO.Stream os = req.GetRequestStream(); > > os.Write(bytes, 0, bytes.Length); > > os.Close(); > > System.Net.WebResponse resp = req.GetResponse(); > > if (resp == null) return; > > System.IO.StreamReader sr = new > System.IO.StreamReader(resp.GetResponseStream()); > > cRet = sr.ReadToEnd().Trim(); > > return; > >
From: Geoff Schaller on 17 Nov 2009 16:31
Agreed! This is the best way. "Ginny Caughey" <ginny.caughey.online(a)wasteworks.com> wrote in message news:007b24b3$0$1569$c3e8da3(a)news.astraweb.com: > Gary, > > Do yourself a favor and learn how to wrap C# code to expose it via COM so > you can just use it directly from VO. I just did sessions about this topic > at VODC, and it really is as easy as 1-2-3. Calling the code from the VO > side requires only 3 lines of code. > > -- > > Ginny Caughey > www.wasteworks.com |