Php api calling with ionic not access cookies?


down vote
Hi Anyone please help me I developed one ts script in ionic framework. In this script i am calling one php file using get method.

URL working fine in POSTMAN if i enable postman interceptor and getting response. But if i disable postman interceptor i am not getting response.

Same URL i am calling in ionic ts script but i am not getting response.

Actually that php file using cookies. That is in different domain. I am calling that url from localhost. here is the js script code

import { Component, Injectable } from '@angular/core';
import { Http, Headers, XHRBackend, Request, RequestOptions, RequestOptionsArgs, Response } from '@angular/http';
import { NavController, NavParams } from 'ionic-angular';
import { HttpService } from '../../services/httpService';
import 'rxjs/add/operator/map';
import { Observable } from 'rxjs/Observable';
  templateUrl: 'chatList.html',
export class ChatDetailsPage {

  constructor(params: NavParams) {
    this.item =;

  template: `
    <ion-title>Chat - Online Members</ion-title>
    <button ion-item *ngFor="let item of items" (click)="openNavDetailsPage(item)" icon-start>
      <ion-icon [name]="'logo-' + item.icon" [ngStyle]="{'color': item.color}" item-start></ion-icon>
      {{ item.title }}
export class ChatHomePage {
  items = [];

  constructor(public nav: NavController, private http: HttpService) {
    //let body = JSON.stringify({buddylist:1,initialize:1,EnableWebpImage:1,AppType:10});
    let headers = new Headers();    
    headers.append('Content-Type', 'application/json; charset=utf-8');    
    headers.append('Accept', '*/*');    
    //headers.append("Access-Control-Allow-Credentials", "true");
    headers.append("Access-Control-Allow-Credentials", "true");
    headers.append("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
    headers.append("Access-Control-Allow-Headers", "Content-Type,Authorization,Upgrade-Insecure-Requests");
    var Url = '';        

    var Shortlist,Contacted,Preferred;   
    var Options = new RequestOptions({params:{buddylist:1,initialize:1,EnableWebpImage:1,AppType:10},headers:headers});
    this.http.get(Url, Options).map(res => res.json()).subscribe(
        data =>{
        err => {
    this.items = [
        'title': 'Shortlisted Members',
        'icon': 'contact',
        'description': 'Shortlisted members available to chat',
        'color': '#0CA9EA'
        'title': 'Contacted Members',
        'icon': 'contacts',
        'description': 'Contacted members available to chat',
        'color': '#F46529'
        'title': 'Preferred Members',
        'icon': 'javascript',
        'description': 'Preferred members available to chat',
        'color': '#FFD439'
  openNavDetailsPage(item) {
    this.nav.push(ChatDetailsPage, { item: item });



Already checked your PHP error log?

Same URL i am calling in ionic ts script but i am not getting response.

No response in your console for?

data =>{
    err => {


i am getting empty json object


Please edit your post, it is not very readable at the moment.
Use the </> button above the input field to format your code, command line output or error message (select the text first, then click the button or wrap it in ``` manually). Check the preview if it looks better. This will make sure your text is readable and if it recognizes the programming language it also automatically adds code syntax highlighting. Thanks.

Copy/pasting a post from Stackoverflow without fixing the formatting (and deleting stuff you copied from the site) is a bit impolite.