Apostrophe in http request

Hi everyone, I’ve got a problem with my application developed with ionic 3.
When I send a string that contains apostophe to my server with ionic-native-http plugin get me back an error. My server was made in php and when it receives the data I use this function for accept the apostrophe:

mysqli_real_escape_string($conn,$_GET['param']); 

With postman it works fine, but if I send the string with the application throw me an exception.
The function in the application is this:

inviaDati(){
    this.http.get('https://domain.com', {req: 'regDitta', param: "the ' string"}, {})
    .then(data => { //not here
      if(data.data == 0){ 
        alert("registrazione effettuata")
      }else{
        alert("errore");
      }
    },
    error => alert("error")) // it always gives me back this error;
  }

I have to encode the string? How can I do that?
Thank you all,
Elia

I am deathly allergic to PHP, but perusing what appears to be a canonical documentation page for this function leads me to believe that this is a terrible, very bad, no good function that should never be used for anything.

The bottom line when dealing with external input and databases is this: use bound placeholders. I don’t know how exactly one does this in PHP, but there must be a way.

Never ever cobble together SQL query strings using ordinary string manipulation functions if any externally-sourced data is involved.

If your parameter is treated as a black box and bound to a proper SQL placeholder, there is no need to do anything extra on the Ionic side, and no need to escape anything on the server side.

Thank you for your response. I try to follow your instruction and I solve this problem using:

str = str.replace(" ' ", " '' ");

I replace the single apostrophe ( ’ ) with double ( ’ ’ ). Now everything seems to work.
Thank you so much.
Elia