cUrl转换为Javascript可能? [英] cUrl Converting into Javascript possible?

查看:153
本文介绍了cUrl转换为Javascript可能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法将它转换为javascript?

is there a way to convert this into javascript?

  <?php
      $url = 'http://www.yourdomain.com/';
      $ch = curl_init();

      curl_setopt($ch, CURLOPT_URL, $url); 
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
      $output = curl_exec($ch); 
      curl_close($ch);

      echo $output;
    ?>


推荐答案

否。

使用标准浏览器环境的JavaScript?也许。有 XHR对象(其中包括状态属性,它会告诉您是否成功),但也有同一来源政策

JavaScript with a standard browser environment? Maybe. There is the XHR object (which includes the status property, which will tell you if it was successful or not), but there is also the same origin policy.

这篇关于cUrl转换为Javascript可能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆