0

my banner cant log by client , when i use iphone app to wrap a banner.

my case is, i have a iphone app with a webpage that contain a banner, when ppl click the banner, it will go to a php script and then redirect to client site, but in client site or the php script, i cant find any referer from fiddler, thus i figure out that iphone apps do not have any referer, since it is not browser

Is there any way to use php to make a fake referer , and then redirect to my target url with the fake referer?

my frd suggest me to use proxy server, is it possible?

user192344
  • 1,274
  • 6
  • 22
  • 36

1 Answers1

1

You could pass-through using curl:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.example.com/2');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, 'http://www.example.com/1');
$html = curl_exec($ch);

Failing that, are you able to manipulate the NSRequest? You could set it like so:

NSMutableURLRequest *urlRequest;
urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"myURL"]];
[urlRequest setValue:@"http://www.example.com/" forHTTPHeaderField:@"Referer"];

I'm not sure what you're trying to do by the way, but it has just occurred to me that you might be violating your terms of use by faking about this information. If you need to display a banner based on a specific URL, the banner API should have something that lets you specify what the user is looking at.

Steve Rukuts
  • 9,167
  • 3
  • 50
  • 72
  • for above php, how can it do the redirect, my case is, i have a iphone app with a webpage that contain a banner, when ppl click the banner, it will go to a php script and then redirect to client site, but in client site or the php script, i cant find any referer from fiddler – user192344 Nov 30 '11 at 09:03
  • 1
    I now understand what you want to do, and I'm afraid that unless you can manipulate the UIWebView in some manner when the user is leaving your PHP script, you will not be able to do this. PHP cannot instruct a client to send a specific referrer header. – Steve Rukuts Nov 30 '11 at 09:07
  • but i saw some article tell me to use fsockopen and then redirect, but i have try it, but i cant find any referer – user192344 Nov 30 '11 at 09:26