Is there a web service API where you can pass in a URL and it returns the HTTP response code?
-
-
Answer:
You can do this in the language of your choice, rather than having to call a web service (a web service that calls a web service?). Here's an example in Python, using httplib: import httplib def get_http_status(host, path='/'): """Returns the status code of the given host and path by requesting HEAD from the host (there's a joke in there somewhere). In the event of a networking error, an httplib exception will be raised. """ connection = httplib.HTTPConnection(host) connection.request('HEAD', path) return connection.getresponse().status print get_http_status('www.quora.com') # Should print '200' print get_http_status('www.quora.com', '/does/not/exist') # Should print '404' You could write an equivalent in PHP, Ruby, or any language that has some form of HTTP library. If you're looking to do this for debugging purposes, take a look at something like HTTP Client (a nifty Mac application): http://ditchnet.org/httpclient/
Anonymous at Quora Visit the source
Other answers
Depending on the programming language you're using, you could just use a built-in library to fetch the url yourself and parse out the response code (e.g. curl functions in PHP, Net::HTTP in Ruby) I would think calling an external web service for this would overcomplicate the solution.
Kyle Bragger
Related Q & A:
- How to deal with timeout when accessing a web service?Best solution by Stack Overflow
- How to call a web service using HttpWebRequest?Best solution by Stack Overflow
- how to consume a web service in mule flow?Best solution by Stack Overflow
- How do I forward gmail raw email to a web service?Best solution by email.about.com
- What Is A Free Online School, Where You Can Work At Your Own Pace?Best solution by answers.yahoo.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.