Bug #53548 [Opn->Bgs]: post failled when '@' is the first character
| From: | aharvey@php.net | Date: | Wed, 15 Dec 2010 08:19:00 +0000 |
| Subject: | Bug #53548 [Opn->Bgs]: post failled when '@' is the first character | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-157008@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=53548&edit=1
ID: 53548
Updated by: aharvey@php.net
Reported by: wangyi6854 at sohu dot com
Summary: post failled when '@' is the first character
-Status: Open
+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:
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.
Previous Comments:
------------------------------------------------------------------------
[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