I would like to use curl to post data from one server to another.
I cannot use anything else like put for example – I cannot change apache settings and it’s not allowed on my server. That’s the reason I would like to do it with post.
I have following code:
if (!empty($_POST)) {
//let's see what's posted
var_dump($_POST);
//unzip data
retrieveData($_POST);
}
function retrieveData($post)
{
$output = false;
if (isset($post['data'])) {
if (isset($post['zipped']) && $post['zipped'] == true) {
$output = bzdecompress ($post['data']);
var_dump($output);
}
}
return $output;
}
result is
array(2) { ["data"]=> string(7) "BZh41AY" ["zipped"]=> string(1) "1" }
string(0) ""
as you can see I get an empty string from bzdecompress function. Any advice?
problem was with encoding chars and not the
bzdecompressfunction.I don’t have to
urlencodeandurldecodecharacters in POST method.