Converting HTTP to FTP URL

J. Landman Gay jacque at hyperactivesw.com
Sun Aug 7 18:22:04 EDT 2011


On 8/7/11 5:12 PM, J. Landman Gay wrote:
> I need a way to convert a web URL to a valid FTP URL. For example,
> convert this:
>
> http://www.domain.com/folder/file.txt
>
> to this:
>
> ftp://user:pass@domain.com/webroot/folder/file.txt
>
> Not all servers use "public_html" so I can't just hard-code that as the
> web root. Is there a generic way to indicate the web folder on a server,
> the same way a tilde indicates the user's home folder? Or any other way
> to get the path?
>
> The user name and password are known.
>

Just to clariy: I tried inserting the "www" alias into the path, since 
virtually all servers support that. It works with primary domains but it 
fails with subdomains. Basically I'm looking for a way to force ftp to 
resolve the "www.domain" part of the URL to an absolute path. My tests 
so far seem to indicate that any initial "www" in the path is ignored 
with ftp.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the Use-livecode mailing list