You'd have to check if URL-encoding supports whatever sort of characters/data is your input. I would *THINK* that URL-encoding standard would support binary data of any kind, and be the correct way to do this, in THEORY. In PRACTICE, it may be that the implementation of URL-encode would not correctly handle binary data. So you might be stuck with base64-encoding as a work-around... I'm pretty sure that base64-encoding output consists only of: 0123456789ABCDEF and newline and maybe the = sign as a continuation character? I may be confusing base64 with something else though... You could probably "get away" then, with not urlencoding after you base64-encode it, as there aren't any characters that are going to get changed in urlencoding... But it would be more "clean" to urlencode() it, no matter what else you have to do to get the data through cleanly, as you ARE passing it into a URL. If your data is really huge or super-over-loaded servers, and you KNOW that base64 can never generate a character that matters, a comment in the code to that effect in place of urlencode() would be Nifty Enough. On Tue, February 21, 2006 4:34 pm, Dirk Vanden Boer wrote: > Thanks for the info, it was really helpfull. One question though, is > it necessary to first encode my data with the base64 algo, or can I > skip that step and immediately urlencode my data? > > Dirk > > On 2/21/06, Richard Lynch <ceo@xxxxxxxxx> wrote: >> You probably should be URL-encoding your data in the first place... >> http://php.net/urlencode >> >> <?php >> $data = "&whatever funky characters you want": >> $data_url = urlencode($data); >> >> //WRONG: >> $URL = "http://example.com/$data" >> >> //RIGHT: >> $URL = "http://example.com/$data_url"; >> >> If it's not feasible for your C++ application to replicate >> urlencode() >> then you may be able to get what you want with that >> http_raw_post_data >> stuff. You'll have to search on php.net for something not unlike >> "raw >> post data" until you find it, as I don't have the ULR in my head. >> >> But you'd be 100% better off to follow the standards and url-encode >> the data in the first place -- Especially if you're ever going to >> re-use this code elsewhere, and MOST especially if you ever might >> want >> to hook up YOUR code to another person's server that actually >> follows >> the standards. >> >> On Tue, February 21, 2006 12:40 pm, Dirk Vanden Boer wrote: >> > Hi, >> > >> > 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? >> > >> > Thanks in advance >> > Dirk >> > >> > -- >> > PHP General Mailing List (http://www.php.net/) >> > To unsubscribe, visit: http://www.php.net/unsub.php >> > >> > >> >> >> -- >> Like Music? >> http://l-i-e.com/artists.htm >> >> >> > -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php