url

checking if url is up and working, if it is to redirect to that url itself else if not working to redirect to another url

namespace WebApplication4 { public partial class _Default : System.Web.UI.Page { public static bool UrlIsValid(string url) { bool br = false; try { IPHostEntry ipHost = Dns.Resolve(url); br = true; } catch (SocketException) { br = false;...

How to restrict some module of GWT based application from accessing it directly via url

I have to secure a section of my GWT based application from accessing it directly via some url. Actually there is an index page which is login page. The use gives credentials and enters into the app (the module to be saved). Currently what I am doing is that when a user logs in I save his username into session ( session.setAttribute(“u...

Is there an equivalent to python's urllib in c/c++ ?

any c/c++ library out there that provides functions like getUrl, urlopen, post etc. ? ...

Regular Expression to Validate Long URLs in PHP

I am looking for help in creating a Regular Expression that validates a URL of very long length (eg. a very long Google Maps address). I am new to regular expressions and I am using it in PHP with preg_match(). I have used the expression: preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/...

How to make this PHP URL parsing function nearly perfect?

This function is great, but its main flaw is that it doesn't handle domains ending with .co.uk or .com.au. How can it be modified to handle this? function parseUrl($url) { $r = "^(?:(?P<scheme>\w+)://)?"; $r .= "(?:(?P<login>\w+):(?P<pass>\w+)@)?"; $r .= "(?P<host>(?:(?P<subdomain>[-\w\.]+)\.)?" . "(?P<domain>[-\w]+\.(?P<ex...

Javascript: getting location.search out of any url?

hey guys, i know top.location.search retruns ?key=anything&blabla=foobar of my current url. I wonder how i can get the search value out of any url? if I have e.g. $goToURL = 'http://www.anydomain.com/hello/?path=xyz how can i get ?path=xyz out there and save it to a variable? regards matt ...

Legacy URLs in CakePHP using routes or htaccess

I'm in the midst of moving a site from "plain old" php to the CakePHP framework and I need to be able to handle some legacy URLs, for example: foo.com/bar.php?id=21 is the pattern of the current URLs, but in the new site using cake, that URL needs to redirect to: foo.com/blah/21 So basically, I need to be able to grab that ID numbe...

Twitter API/Query to search in user profiles?

Is there some way I can search in the profiles of users on Twitter? e.g. User A has mentioned that he is "security, hacking geek" and his website is http://hackme.com Now i want to search in 2 ways: Search for "security" or "hacking" in user profiles and all users including A who have the word security in their profiles will be retur...

what is the URL equivalent of an absolute path in non-windows system?

Hi, I am getting following exception while running BIRT from a Linux OS. Caused by: org.eclipse.datatools.connectivity.oda.OdaException: no protocol: /home/lsingh/reporting/tmp/execution1279514184559/TDReport.xml where "/home/lsingh/reporting/tmp/execution1279514184559/TDReport.xml" is my XML data file. When i looked into the code of...

How to get user name and password from url in ASP.NET?

How can get in ASP.NET user name and password from URL? https://myUser:myPassword@myServer/ HttpContext.Current.Request.Url is returning https://myServer/. ...

Submitting a form via GET to a rewritten URL.

I've got a website where URLs are rewritten in this format: http://www.example.co.uk/module/page/query/ http://www.example.co.uk/index.php?m=module&amp;p=page&amp;q=query Which gives rise to pages such as: http://www.example.co.uk/schools/view/495/ http://www.example.co.uk/schools/search/park+lane/ Is there any way to make it so th...

How to automatically replace `url` in browser address bar with JavaScript: from /en/services/ to /en/#services ?

How to automatically replace url in browser address bar with JavaScript from   company.com/en/services/ to       company.com/en/#services ? Example: when I type in browser address bar url company.com/en/services/ and click 'Go', it will be automatically seen company.com/en/#services Is there any way to replace real url /services/ with h...

My hosting is messing up my urls.

Usually when I get the url of a request i use Request.RawUrl. This gives /default.aspx for example. However recently my host changed something and now the name of the application directory is displayed as well so i get /appdirname/default.aspx. Now why does it give me the directory of the application? It looks as if my website is a su...

Ruby on Rails - generating bit.ly style uuids

Hello, I'm trying to generate UUIDs with the same style as bit.ly urls like: http://bit.ly/aUekJP or cloudapp ones: http://cl.ly/1hVU which are even smaller how can I do it? I'm now using UUID gem for ruby but I'm not sure if it's possible to limitate the length and get something like this. I am currently using this: UUID.generat...

JavaScript - Improve the URL parameter fetching algorithm

I need to get the URL search paramentes in an object, for eg; http://example.com/?a=x&amp;b=y&amp;d#pqr should yield {a:x, b:y, d:1} Below is the method i used to get this, How can i improve this? any suggessions... var urlParamKeyVals = new Array(); var pieces = new Array(); var UrlParams = {}; ...

RESTful URLs and folders

On the Microformats spec for RESTful URLs: GET /people/1 return the first record in HTML format GET /people/1.html return the first record in HTML format and /people returns a list of people So is /people.html the correct way to return a list of people in HTML format? ...

How do you append for example ?lang=en_US to the url based on a cookie containing country code?

Hi. I have a code like this that extract the country code saved in the cookie. if (isset($_COOKIE['country'])) { $country = $_COOKIE['country']; $language = "eng"; if ($country == "NO"){ $language = "nor"; } ...

Url encoding in Android

How do you encode an url in Android? I thought it was like this: final String encodedURL = URLEncoder.encode(urlAsString, "UTF-8"); URL url = new URL(encodedURL); If I do the above, the http:// in urlAsString is replaced by http%3A%2F%2F in encodedURL and then I get a java.net.MalformedURLException when I use the url. Thanks! ...

PHP - extracting specific <a href> urls out of the document

I think this should be elementary, but I still cant't get my head around it. Let's say there's fair amount of HTML documents and I need to catch every image urls out of them. The rest of the content changes, but the base of the url is always the same for example http://images.examplesite.com/images/, so I wan't to extract every string t...

Multilanguage site in Codeigniter

I'm starting a new site project in Codeigniter. I need this site to be multilingual, where English will be the default language. I know how the language class in codeigniter works, and I am already using it. My concern is that I need the URL to be shown in the selected language. I'll explain myself with an example: When English langu...