draw62188 2016-04-13 17:02
浏览 110
已采纳

PHP在另一台服务器上执行PHP并获得结果

My shared hosting does not support postgresql php functions, but I need to load some images from postgresql which is hosted remotely on a dedicated server.

Would it be possible to have a PHP script on the server with postgresql and then another PHP script on the shared hosting would call the script on the postgresql server to get the images from the dedicated server to the shared hosting but I don't want the IP or domain of the dedicated server ever to be revealed.

Would this be possible? if so how?

  • 写回答

4条回答 默认 最新

  • donglianer5064 2016-04-13 17:17
    关注

    it's even much easier with file_get_contents():

    $img_binary = file_get_contents("https://i.imgur.com/1H9Ht5a.png");
    $img_base64 = base64_encode($img_binary);
    echo '<img src="data:image/png;base64,' . $img_base64 . '">';
    

    plus: it's a standard PHP method where "cURL" might not be activated in every PHP environment.

    be careful with the type of your image. replace data:image/png; with data:image/jpeg; or other image formats accordingly.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?