You can stat (get filesize, modification time, permissions) only local files - download it first and then get its filesize if you need it.

Steve Keller wrote:

I'm still trying to get a file posted to another server, but I seem to have run across an odd snag, and I was hoping someone can point out where I've gone wrong. Here's the code:

<?
$data = "mtype=XMLDOC&outfile=true";
$dataFile = "http://www.healthtvchannel.org/courses/pay/data/test.xml";;
$fileSize = filesize($dataFile);
$fp = fopen($dataFile, "rb");
$strFile = fread($fp, $fileSize);
fclose($fp);

$osbURL="https://partners.netledger.com/SmbXml";;

$ch = curl_init();
$res = curl_setopt($ch, CURLOPT_POST, 1);
echo "Set Post: ".$res;
$res = curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
echo "<br />Set Follow: ".$res;
$res = curl_setopt($ch, CURLOPT_VERBOSE, 1);
echo "<br />Set Verbose: ".$res;
$res = curl_setopt($ch, CURLOPT_URL, $osbURL);
echo "<br />Set URL: ".$res;
$res = curl_setopt($ch, CURLOPT_POSTFIELDS, $data."&mediafile=".$strFile);
echo "<br />Set Postfields: ".$res;
$res = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
echo "<br />Set ReturnTransfer: ".$res;

$result = curl_exec($ch);
curl_close($ch);
echo $result;
?>

What I'm getting is

Warning: stat failed for http://www.healthtvchannel.org/courses/pay/data/test.xml (errno=2 - No such file or directory) in /usr/local/www/vhosts/healthtvchannel.org/htdocs/courses/pay/posttest.php on line 20

I'm positive the file exists, and if I cut and paste the URL from the error to a browser window, I can see the file. What am I doing wrong?
--
S. Keller
UI Engineer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Pkwy.
Anchorage, AK 99508
907.770.6200 ext.220
907.336.6205 (fax)
Email: [EMAIL PROTECTED]
Web: www.healthtvchannel.org



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to