简体   繁体   English

从iPhone上的Web服务器定义URL

[英]Define URL from a web server on iphone

I am working on an iphone app. 我正在使用iPhone应用程序。 now i am messed up with a issue. 现在我搞砸了一个问题。 I want to link a file download path URL with a button, so when user click that button, it downloads file from URL at back. 我想用一个按钮链接文件下载路径URL,所以当用户单击该按钮时,它将从后面的URL下载文件。 Problem is that URL changes so frequently for which i am thinking of doing such that first it seeks for URL online & then downloads. 问题是URL更改如此频繁,而我正在考虑这样做,以至于它首先在线查找URL,然后下载。 Can anyone help me with that ? 有人可以帮我吗? So that i just change URL online anytime behind the back of that button in App. 这样我就可以随时在线更改App中该按钮后面的URL。 If i make static URL at the back of that button, its not gonna work because client says that URL changes almost every 4 days. 如果我在该按钮的后面设置了静态URL,则它将无法正常工作,因为客户端说URL几乎每4天就会更改一次。

Thanks in advance for help. 在此先感谢您的帮助。

Example: 例:

just as 2 days ago, URL was : tv.cinstedac.com/iphone/stream.m3u8 就像2天前一样,URL为:tv.cinstedac.com/iphone/stream.m3u8

but now URL is tv.cinstedac.com/iphone/stream1.m3u8 但现在的网址是tv.cinstedac.com/iphone/stream1.m3u8

All i want is to do such that when a person click on that button it downloads file at url, but what will be solution of changing URL ? 我只想做的是,当一个人单击该按钮时,它将以url下载文件,但是更改URL的解决方案是什么? So that i change it online & it gets updated on App as well ! 这样我就可以在线更改它,并且它也会在App上更新!

the easyest way is to have a static url to a webserver that will return the proper url i suppose. 最简单的方法是将静态网址发送到Web服务器,该网址将返回我认为正确的网址。 But your question is not 100% clear as of where this url could be found. 但是,关于在哪里可以找到此网址,您的问题尚不完全清楚。

EDIT 编辑

Your edit confirmed my guess, you will need to have a page that is always at the same adress (for example tv.cinstedac.com/iphone/giveStreamUrl.php). 您的修改证实了我的猜测,您将需要拥有一个始终使用相同地址的页面(例如tv.cinstedac.com/iphone/giveStreamUrl.php)。 which will give only one line of output: 这将只给出一行输出:

tv.cinstedac.com/iphone/stream1.m3u8

you could get this url from a database for example. 例如,您可以从数据库中获取该网址。 If you want example code i will need some more info about where you will get this url from (database, txt file, etc). 如果您想要示例代码,我将需要一些有关从何处获取此url的更多信息(数据库,txt文件等)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM