Q:
when is use the below code to read a file using the
absolute path like /www120/web/xyz/wmail/login.htm or relatve path
./login.htm it works.
But when i use the domain name to www.domain.com/wmail/login.htm it is not
working please advice me
A:
I can not see the code...
I am almost certain that you open the file using some form of open, that
can open files and NOT URLs. Anyway: www.domain.com/wmail/login.htm is not
even a URL as it does not specify the protocol, that has to be part of the
URL.
Peter
Q:
<?
// The purpose of this code is to check whether we can read/write files in
to another domain
// i.e from www.xxxxxx.com to www.yyyyyy.com i need a solution for this
$fname1 = 'www.domain.com/wmail/login.htm';
$fname2 = 'http://www.domain.com/wmail/login.htm';
$fname3 = 'login.htm';
$fname4 = '/www120/web/QQQQ/wmail/login.htm';
// Here the www.domain.com is mapped to /www120/web/QQQQ so
echo read_file($fname1); // It is not working
echo read_file($fname2); // It is not working
echo read_file($fname3); // It is working
echo read_file($fname4); // It is working
function read_file($strfile) {
if($strfile == "" || !file_exists($strfile)) return;
$thisfile = file($strfile);
while(list($line,$value) = each($thisfile)) {
$value = ereg_replace("(\r|\n)","",$value);
$result .= "$value\r\n";
}
return $result;
}
?>
A:
Sorry, but this is PHP.
I am not familiar with PHP at all. I know that PHP can open URLs just like
local files using some built in functions, but this is just a slight
touching knowledge and I never practiced PHP.
If you have any Perl or C question, I will help you.
Sorry.
Regards,
Peter
[ back to toc ]