Edit report at http://bugs.php.net/bug.php?id=53548&edit=1
ID: 53548 Comment by: wangyi6854 at sohu dot com Reported by: wangyi6854 at sohu dot com Summary: post failled when '@' is the first character Status: Bogus Type: Bug Package: cURL related Operating System: FreeBSD 8.1 PHP Version: 5.3.4 Block user comment: N Private report: N New Comment: Yes. But curl should provide a option to turn it off. The project I involve limits the length of post field. So add some char into the front of the string is not possible. I check the curl's manual(command line version). it has a global option to turn it off. But I can't found the way to turn off some particular fields. Any suggestion? Thanks! Previous Comments: ------------------------------------------------------------------------ [2010-12-15 09:19:00] [email protected] As documented on the curl_setopt() manual page, CURLOPT_POSTFIELDS will assume that a value starting with @ is the location of a file to use as the post data, and not the literal post data itself. ------------------------------------------------------------------------ [2010-12-15 09:04:59] wangyi6854 at sohu dot com Description: ------------ curl post will failed when post field's first char is '@'. the ip address in the following code is www.example.com's. You can replace it with any address. Test script: --------------- <?php $msg = ''; if ( !empty( $_POST ) ) { $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, "http://192.0.32.10/" ); curl_setopt( $ch, CURLOPT_POST, 1 ); curl_setopt( $ch, CURLOPT_POSTFIELDS, array( 'test' => '@aaaa' ) ); if ( false === curl_exec( $ch ) ) { $msg .= 'curl error: ' . curl_errno( $ch ) . ".\nmessage: " . curl_error( $ch ) . PHP_EOL; } else { $msg .= 'OK!'; } curl_close( $ch ); } ?> <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head></head> <body> <pre><?php echo $msg; ?></pre> <form method="post" action=""> <input type="submit" name="test" value="test!" /> </form> </body></html> Expected result: ---------------- curl should work whatever the content is. Actual result: -------------- curl will failed when post field's first char is '@'. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53548&edit=1
