I have the following code.
$connect = new Connection ();
$response = $connect->putFile($fileName, $destination);
header("Location: /test.php?response=" . $response);
When I invoke header with the response, the file will stop execution, but I will have no error in the console... I am thinking maybe this array needs to be encoded for the url?
if that is the case how?
Thank you
If $response
is a multi-dimensional array, you may fare best by serialize()ing it and urlencode() ing the result. It adds some overhead but not too much.
However, transporting data through GET is seriously limited. The amount of data should not exceed 1-2 kilobytes. Source: For example here
If your data is likely to exceed that limit, you should think about either transporting the data through POST
or, if that's not possible, in a session or other kind of persistent storage.
Use http_build_query()