dongyiyu882684 2011-09-11 09:39
浏览 67

如果我在文本框中输入一个链接,如果我们在某个页面上获得它的输出,它应该像一个链接

I want to create a textbox like if I enter a link in it & insert this data into some mysql database by PHP & then I get its output on a php page, it should behave like that specific link.

Eg:

<form>
<input type="" name="text" />
<input type="submit" value="submit" />
</form>

suppose I enter http://stackoverflow.com in the textbox & get output of this text then the output should be exactly http://stackoverflow.com, which when clicked should take me to http://stackoverflow.com...

this textarea of stackoverflow.com in which I'm adding this question is also just like what I want...

Please tell me if someone knows.

Thanks!!! Muddser

  • 写回答

3条回答 默认 最新

  • douwen1915 2011-09-11 09:43
    关注
    if ($_POST['text']){
        preg_match_all('~((https?|ftp)://.*?) ~', $_POST['text'], $urls);
        foreach($urls[1] as $url){
            echo file_get_contents($url); // you can change echo to whatever you want
    
        }
    }
    

    and change method to POST

    评论

报告相同问题?

悬赏问题

  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表