<?php
$url="http://www.hao123.com/";
$fp=@fopen($url,"r");
$fg=file_get_contents($url);
eregi("<body(.*)</body>",$fg,$ty);
$ty[1]=str_replace("src=\"../index/images/","src=\"http://s1.hao123img.com/index/images/",$ty[1]);
echo $ty[1];
?>//无法获取图片,我自己的目录下有/index/images/文件夹求解释
$url="http://www.hao123.com/";
$fp=@fopen($url,"r");
$fg=file_get_contents($url);
eregi("<body(.*)</body>",$fg,$ty);
$ty[1]=str_replace("src=\"../index/images/","src=\"http://s1.hao123img.com/index/images/",$ty[1]);
echo $ty[1];
?>//无法获取图片,我自己的目录下有/index/images/文件夹求解释
这句话是不是写反了,$ty[1]这里面的图片肯定是s1.hao123img.com里面的图片,肯定不会有../index/images/这种路径,楼主是不是想把获取到的内容图片路径换成自己服务器下的路径啊?
$ty[1]=str_replace("src=\"http://s1.hao123img.com/index/images/","src=\"../index/images/",$ty[1]);