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 for more info on providers
   and Angular DI.
 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));**

     return new Promise(resolve => {
		     .map(res => res.json())
		     .subscribe((data: any) => {
  			     **console.log("check1 :"+data['data']);**
  			     **console.log(JSON.stringify("check2 :";**
  			     this.url= JSON.stringify(;
  			     resolve ((;
		     }, error => {

     return this.url;

console output of the check0, check1 and check2 is
check0:object Promise
check1 :
“check2 :”

what i want to do is set “” 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?