Edit report at http://bugs.php.net/bug.php?id=51890&edit=1
ID: 51890 User updated by: seizu at gmx dot at Reported by: seizu at gmx dot at Summary: CURL Problem Status: Bogus Type: Bug Package: cURL related Operating System: Windows XP PHP Version: 5.3.2 New Comment: --snip-- docu fopen 'r+' Open for reading and writing; place the file pointer at the beginning of the file. 'w+' Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it. --snip-- when I use "wb+" the existing file will be truncate and that is not what I want, so I have to use "rb+" anyway ...and sorry, it has nothing to do with the absolute php-path it just a problem with php versions >5.2.8 Previous Comments: ------------------------------------------------------------------------ [2010-05-29 11:05:29] seizu at gmx dot at When you write into an "EXISTING FILE" "rb+" should work apart from that, the script works if you dont provide an absolute php-path! ------------------------------------------------------------------------ [2010-05-29 07:59:21] [email protected] You cannot do a writable operation using CURLOPT_FILE when the file pointer is opened with 'r', use 'wb+' instead of 'rb+'. ------------------------------------------------------------------------ [2010-05-22 23:10:16] seizu at gmx dot at Description: ------------ The script copy the URL into an existing file (robot.txt) The error occurs when you run the test script from the command line by providing the absolut path of your php.exe like >c:\php\php.exe test.php When you don't provide the absolut php path, the problem does not occure >php test.php Test script: --------------- <?php $outfile="c:\\robots.txt"; $infile="http://www.astrobox.at/robots.txt"; $ch = curl_init($infile); $fo = fopen($outfile, "rb+" ); curl_setopt($ch, CURLOPT_FILE, $fo); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); fclose($fo); ?> Expected result: ---------------- nothing Actual result: -------------- C:\phpda>c:\php\php.exe C:\phpda\test.php PHP Warning: curl_setopt(): the provided file handle is not writable in C:\phpda\test.php on line 7 Warning: curl_setopt(): the provided file handle is not writable in C:\phpda\test.php on line 7 User-agent: * Disallow: /administrator/ Disallow: /cache/ Disallow: /components/ Disallow: /editor/ Disallow: /help/ Disallow: /images/ Disallow: /includes/ Disallow: /language/ Disallow: /mambots/ Disallow: /media/ Disallow: /modules/ Disallow: /templates/ Disallow: /installation/ Disallow: /astrobox/produkte/ Disallow: /option/ ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=51890&edit=1
