MIParseURL() function - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Parses a URL string and returns the type of service and its components.

Syntax

MIParseURL( ByVal strURL As String, pServiceType As Integer, 
	pServer As String, ByVal nServerLen As Integer, 
	pObject As String, ByVal nObjectLen As Integer, 
	pPort As INTERNET_PORT )
	As SmallInt

strURL is a string that contains the URL to be parsed.

pServiceType is a reference to a integer that receives the type of Internet service. The possible values are one of the following:

  • INTERNET_SERVICE_FTP
  • INTERNET_SERVICE_GOPHER
  • INTERNET_SERVICE_HTTP
  • AFX_INET_SERVICE_UNK
  • AFX_INET_SERVICE_FILE
  • AFX_INET_SERVICE_MAILTO
  • AFX_INET_SERVICE_MID
  • AFX_INET_SERVICE_CID
  • AFX_INET_SERVICE_NEWS
  • AFX_INET_SERVICE_NNTP
  • AFX_INET_SERVICE_PROSPERO
  • AFX_INET_SERVICE_TELNET
  • AFX_INET_SERVICE_WAIS
  • AFX_INET_SERVICE_AFS
  • AFX_INET_SERVICE_HTTPS

strsServer is a reference to a string that specifies the first segment of the URL following the service type.

nServerLen is the size of the buffer referenced by strsServer.

pObject is a reference to an object that the URL refers to (may be empty).

nObjectLen is the size of the buffer referenced by pObject.

pPort is a reference to an integer that contains the determined port number from either the Server or Object portions of the URL, if either exists. The port number is used to identify the TCP/IP port to use on the server.

Return Value

Nonzero if the URL was successfully parsed; otherwise, 0 if it is empty or does not contain a known Internet service type. To determine the cause of the failure, call the MIGetErrorMessage() function.

Description

MIParseURL() parses a URL string and returns the type of service and its components. For example, it parses URLs of the form: ftp://ftp.mysite.org/ and returns its components stored as follows:

pServer == "ftp.mysite.org" 
			pObject == "/" 
			nPort == #port 
			pServiceType == INTERNET_SERVICE_FTP