Cannot set http post response data to a variable

I am using a http request to get a url from a server and it returns correct data as the response.
this is my code

 import { Injectable } from '@angular/core';
 import { Http, RequestOptions, Headers, ResponseType } from '@angular/http';
 /*
   Generated class for the GlobalProvider provider.

   See https://angular.io/guide/dependency-injection for more info on providers
   and Angular DI.
 */
 @Injectable()
 export class GlobalProvider {

   public baseurl:any;

   constructor(public http: Http) {
     **this.baseurl=  this.geturl();**
     //this.baseurl = "http://localhost/ppweb/phpweb/index.php/admin/getip";
         **console.log(("check0 :"+this.baseUrl));**
         
   }

   geturl(){
     return new Promise(resolve => {
	     this.http.get('http://localhost/mechmarcl_website/index.php/Admin/getpublicip')
		     .map(res => res.json())
		     .subscribe((data: any) => {
  			     **console.log("check1 :"+data['data']);**
  			     **console.log(JSON.stringify("check2 :"+data.data));**
  			     this.url= JSON.stringify(data.data);
  			     resolve ((data.data));
		     }, error => {
  		     resolve(error);
		     });
     });
   }

   getpub(){
     return this.url;
   }
 }

console output of the check0, check1 and check2 is
check0:object Promise
check1 :192.168.9.5/index.php/admin/getip
“check2 :192.168.9.5/index.php/admin/getip”

what i want to do is set “192.168.9.5/index.php/admin/getip” to the baseUrl variable.

What am i doing wrong here?

Hopefully you have also updated this function to use HttpClient. What does it look like afterwards?