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条)

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!