I'm developing an app using react native, my job is make this app register a new record on my database located in my server. For this I have a file in my FTP (register.php) used to register a record on my database.
This is the php code:
<?
ini_set('memory_limit', '512M');
header("Content-Type: text/html; charset=UTF-8",true);
$user_id = $_GET['user_id'];
$url = $_GET['url'];
$db = mysqli_connect('mysql.urlAdress.com.br','dbName','password' ) or die( 'Conexion error' );
mysqli_select_db($db,'dbName');
if (!$db){
echo '[{"erro": "Error trying to connect to the database"';
echo '}]';
}else {
$result = mysqli_query($db,"insert into profile (user_id, url) values ('$user_id', '$url') ");
}
mysqli_close($db);
?>
I just have to acess a link like this passing some information: http://www.mysite.com.br/app/ws/register.php?user_id=MyName&url=http:://urlHere.com
The problem is: always the php replace characters like: "%2F" by "/" and "%20" by "space". And then when I bring the url back into my app I can't be able to download the content of the url because it's "corrupted" by php. How can I fix this???
PS: In my database the field that receives the url from php is a Varchar: 300 lenght.