How to detect php web page is running within my iPhone App other than Safari

I have built an iPhone app(not iPad) and I am running a webpage within a Web View controller. My question is how can the PHP file detect that it is being run from within this App's UIWebView controller NOT Safari. I want the PHP page to react differently(i.e. get rid of html menu) if run within this app than safari mobile web browser. Is this possible?

WebView Controller

#import "AccountViewController.h"

@interface AccountViewController ()


@implementation AccountViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    return self;

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidLoad];
    NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"account" ofType:@"html"]isDirectory:NO];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
    [_AccountWebView loadRequest:requestObj];

-(void)webViewDidFinishLoad:(UIWebView *)webView {
    NSHTTPCookieStorage *sharedHTTPCookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
    NSArray *cookies = [sharedHTTPCookieStorage cookiesForURL:[NSURL URLWithString:@""]];
    NSEnumerator *enumerator = [cookies objectEnumerator];
    NSHTTPCookie *cookie;
    while (cookie = [enumerator nextObject]) {
        NSLog(@"COOKIE{name: %@, value: %@}", [cookie name], [cookie value]);

- (void)didReceiveMemoryWarning
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.



<?php require_once('Connections/Uniitee.php'); 

$iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$android = strpos($_SERVER['HTTP_USER_AGENT'],"Android");
$palmpre = strpos($_SERVER['HTTP_USER_AGENT'],"webOS");
$berry = strpos($_SERVER['HTTP_USER_AGENT'],"BlackBerry");
$ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod");

if ($iphone || $android || $palmpre || $ipod || $berry == true) 
   header('Location: login-m.php');



You could load a different URL parameter in the app, such as ?appview=true, and in the PHP use if($_GET['appview']).

You could then set a session that app view is true to use throughout the users session

Need Your Help

what about using a static class with static properties returning new instances of concrete classes extending an abstract one

c# design-patterns architecture static instance

MyObject has a shape and the shape have to be chosen and passed as argument to the ctor, can't exist a MyObject whitout a shape and the shape can't vary along his life. It happens often in real lif...

Login_redirect hook not working

php wordpress redirect login hook

I have already used this hook in the same way described below, What could be going wrong?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.