ok so due to some spanking by senior members in other forums i have been suggested to not use exec() function but just strait CURL. So this is what i have. the final result is a sctring when i thought i was going to get an array(). How do i get an array to show. Current out put is..
array(3) { ["test1"]=> string(1) "x" ["test2"]=> string(2) "yy" ["test3"]=> string(3) "zzz" }
Here are my files -
curl1.php -
<?php
$_POST['test1'] = "1";
$_POST['test2'] = "2";
$_POST['test3'] = "3";
// Convert Array to POST string (key_1=val_1&key_2=val_2...)
reset($_POST);
while (list ($key, $val) = each($_POST)) {
$data .= $key . "=" . urlencode($val) . "&";
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://localhost/clients/curl2.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
if (curl_errno($ch)) {
print curl_error($ch);
}
curl_close($ch);
print_r($response);
?>
curl2.php -
<?php
unset($_POST);
$_POST['test1'] = "x";
$_POST['test2'] = "yy";
$_POST['test3'] = "zzz";
var_dump($_POST);
?>
When i try to get any value from $responce, i get one character a. How do i get $response in the first file to be an array i can use not a string.
Thank you.