PHP远程读取文件(带跨域) 先看例子:例如这个http://www.bhzjy.com站上所放置的PHP文件可以正常读取新浪爱问的共享MP3,就像浏览者用浏览器访问它的文件而不会受到URL的错误跳转,实现PHP远程读取文件(带跨域),不知道用PHP的哪些知识可以。像百度音乐就实现了。高手来答辩! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 研究一下snoopy吧,这东西能帮到你! <?php$content = get_content("http://www.baidu.com");function get_content($url){ $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_HEADER, 0); ob_start(); curl_exec ($ch); curl_close ($ch); $string = ob_get_contents(); ob_end_clean(); return $string; }?> <?php$txt = file_get_contents("http://www.baidu.com");echo $txt."<br>";echo htmlspecialchars($txt);//想用什么 用正则匹配就好了?> bing19870624 您的代码提示500服务器错误 数据库读取 图片地址 显示在 php页面里面! 高手请进100份啊--UCHOME中关于文件上传的问题 开新帖:php怎么分词 去查找数据库中相应的内容 新手关于PHP开发环境的困惑 magento 迁移问题 一个免费方便使用的图片管理系统piccms,php语言开发 一条帖子多条评论怎么处理 代码如何写 数据库如何建 memcache服务器装不上是怎么回事 memcache 多服务器 27岁,准备学PHP,求大神指导方向 急急数组取值?~~~~在线等待? PHP验证码不显示
$content = get_content("http://www.baidu.com");
function get_content($url)
{
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_HEADER, 0);
ob_start();
curl_exec ($ch);
curl_close ($ch);
$string = ob_get_contents();
ob_end_clean(); return $string;
}?>
<?php
$txt = file_get_contents("http://www.baidu.com");
echo $txt."<br>";
echo htmlspecialchars($txt);//想用什么 用正则匹配就好了
?>
您的代码提示500服务器错误