Re: Reading binary http post

From: Date: Thu, 23 Feb 2006 03:18:40 +0000
Subject: Re: Reading binary http post
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-230930@lists.php.net to get a copy of this message
Hello, on 02/21/2006 03:40 PM Dirk Vanden Boer said the following: > I have a C++ application that posts binary data to a php script that I > created using libcurl. Everything works fine except when my binary data > happens to start with the '&' symbol. In that case I can't read the http > post data (isset returns false). > > The post argument then looks like data=&ÑÚA > Reading the post is done like this: > if (isset($_POST['data']) > Is there a way to fix this problem? The problem is that you are misleading PHP telling that you are posting form data. You need to correct the request Content-Type. It must not be application/x-www-form-urlencoded nor multipart/form-data . I think you can use anything except those types, like for instance application/octet-stream which is the default for binary files. I don't know how can you hack libcurl to make it use the right request content-type. It is probably easy. If you are not able to do it, you may want to try this PHP HTTP client class . It can send custom POST requests. http://www.phpclasses.org/httpclient -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/

« previous php.general (#230930) next »