webrequest

Android Index out of bounds

柔情痞子 提交于 2019-11-30 09:55:44
问题 I am trying to get the bold text next to the hour scheldule ( from http://golfnews.no/golfpaatv.php )put it in a String array , then , show it on my device's screen. I've put the Internet Access permission , so that is not the problem.The application crashes on my device . Reason : index out of bounds . I don't understand where's the problem . My code is : package com.work.webrequest; import java.io.IOException; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import

ASP.NET Multithreading Web Requests

懵懂的女人 提交于 2019-11-30 09:45:02
I'm building a page in my ASP.NET solution that retrieves most of its data from a 3rd Party API Service. The page itself will need to make approximately 5 individual different calls to the API to populate all of its controls, as each Web Request to the API brings back different sets of Data. I would like to deal with each separate Web request i make on a new thread, simultaneously so that load time is reduced. Each request I'm making looks like this :- WebRequest request = WebRequest.Create(requestUrl); string response = new StreamReader(request.GetResponse().GetResponseStream()).ReadToEnd();

Downloading pdf file using WebRequests

我的梦境 提交于 2019-11-30 09:04:32
I'm trying to download a number of pdf files automagically given a list of urls. Here's the code I have: HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "GET"; var encoding = new UTF8Encoding(); request.Headers.Add(HttpRequestHeader.AcceptLanguage, "en-gb,en;q=0.5"); request.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip, deflate"); request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"; request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0"; HttpWebResponse resp = (HttpWebResponse

Monotouch: WebRequest connection fails after switching off Airplane Mode on iPhone

安稳与你 提交于 2019-11-30 07:42:11
My monotouch app is doing periodic background synchronization with a web-service. It runs perfectly and detects Airplane mode correctly. When I switch off WiFi, it automatically starts using the WWAN (GPRS, 3G) connection. So far I'm very satisfied, but... After switching off Airplan Mode there is no way my app will reconnect when there is no WiFi available. It detects correctly using a NetworkReachability object that WWAN is available and that a connection is required. But the first try times out (after 90 seconds I abort the running request using a timer). When I try again I get a

How do I programmatically send information to a web service in C# with .NET?

若如初见. 提交于 2019-11-30 07:35:17
I know this sort of counts as reinventing the wheel here, but I need to know to communicate with a web service through http/soap/xml and web messages. The reason is I need to communicate with a third party web service for work, but there is something wrong with the WSDL or something and it does not work when connecting to it with the .NET wizard. So, can anyone give me a process/simple example/etc. of how to do this or can anyone give me a link to somewhere that explains it? I'm not very savvy with web requests and responses. How do I construct and send the request? How do I parse the response

How to get website title from c#

≡放荡痞女 提交于 2019-11-30 06:42:59
I'm revisiting som old code of mine and have stumbled upon a method for getting the title of a website based on its url. It's not really what you would call a stable method as it often fails to produce a result and sometimes even produces incorrect results. Also, sometimes it fails to show some of the characters from the title as they are of an alternative encoding. Does anyone have suggestions for improvements over this old version? public static string SuggestTitle(string url, int timeout) { WebResponse response = null; string line = string.Empty; try { WebRequest request = WebRequest.Create

Reading data from an open HTTP stream

♀尐吖头ヾ 提交于 2019-11-30 04:58:50
I am trying to use the .NET WebRequest/WebResponse classes to access the Twitter streaming API here "http://stream.twitter.com/spritzer.json" . I need to be able to open the connection and read data incrementally from the open connection. Currently, when I call WebRequest.GetResponse method, it blocks until the entire response is downloaded. I know there is a BeginGetResponse method, but this will just do the same thing on a background thread. I need to get access to the response stream while the download is still happening. This just does not seem possible to me with these classes. There is a

PowerShell v3 Invoke-WebRequest: Troubles with forms

对着背影说爱祢 提交于 2019-11-30 01:16:23
问题 Since I upgraded to Windows 8 a lot of my PowerShell scripts relying on launching an invisible IE won’t quite work anymore, so I tried switching to the Invoke-WebRequest command. I did a lot of googling but still can’t get my script to work. This is what it should do: load up a website with a simple form (username, password, submit-button), enter the credentials and submit them. With the "help" of the incredibly bad Microsoft tech-net examples (at least for me), I pieced the following

URL forwarding using Chrome webRequest after response is received

五迷三道 提交于 2019-11-29 23:09:22
问题 I am attempting to create a Chrome extension that utilizes Chrome's webRequest module to perform a redirect to a URL obtained from an initially accessed URL. For this I would like to utilize only Chrome's webRequest functions (e.g., onBeforeSendHeaders, onHeadersReceived) and not simply perform a call to $.ajax() with the obtained URL. The desired functionality is: User enters a URL in the address bar A request is made and the secondary URL is extracted from the HTTP response The chrome

WebRequest has no GetResponse method - Windows Phone 8

▼魔方 西西 提交于 2019-11-29 18:15:44
I want to send a post request to an API with some parameters they ask for... I ended up just creating a string, it's ugly but I do not know a way of making it work differently. I then found lots of variations on this WebRequest class, but unfortunately I cannot get it to work. Main problem is probably because I am not really understanding how this is all fitting together but basically, the examples I have been following use WebRequest method GetResponse ... even on MSDN it has this, so I am wondering why when I try to call it in my code, I am not getting that choice? Same goes for