How to find Port number of IP address?

Unfortunately the standard DNS A-record (domain name to IP address) used by web-browsers to locate web-servers does not include a port number. Web-browsers use the URL protocol prefix (http://) to determine the port number (http = 80, https = 443, ftp = 21, etc.) unless the port number is specifically typed in the URL (for … Read more

What is the best regular expression to check if a string is a valid URL?

I wrote my URL (actually IRI, internationalized) pattern to comply with RFC 3987 (http://www.faqs.org/rfcs/rfc3987.html). These are in PCRE syntax. For absolute IRIs (internationalized): To also allow relative IRIs: How they were compiled (in PHP): Edit 7 March 2011: Because of the way PHP handles backslashes in quoted strings, these are unusable by default. You’ll need … Read more

URL Encoding Issue %3D instead of (=)

Do you mean that you want the submitted form data to look like this: In either the URL query string, or in the POST body of an application/x-www-webform-urlencoded request? If so, then no, you cannot do that. That is a violation of both the URL and application/x-www-webform-urlencoded specifications. = is a reserved separator character that cannot appear unencoded in the name and value fields, it … Read more

Download Returned Zip file from URL

Most people recommend using requests if it is available, and the requests documentation recommends this for downloading and saving raw data from a url: Since the answer asks about downloading and saving the zip file, I haven’t gone into details regarding reading the zip file. See one of the many answers below for possibilities. If … Read more