Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Dec 11, 2008, 03:32 AM   #1
iphonejudy
macrumors 6502
 
Join Date: Sep 2008
Problem in accessing content of a web by passing variable

Hi,


I need to display a content of a website by passing a value.

my link is
http://www.xxx.com/xxx.aspx?country=code;

here i want to pass a code as a variable.(because code value is 100,101,102).According to the value the content will be changed.

[HTML]So i get a value of code in a textfield and store it in a variable called code.

code=textfield.text;


//To concatenate url with "code"

NSString *urlContents = [NSString stringWithFormat:
@"http://www.xxx.com/xxx.aspx?country=?
%@",code ];

urlContents having(http://www.xxx.com/xxx.aspx?country=100).

//To display Contents

*NSString *urlContents1 = [NSString stringWithContentsOfURL:
[[NSURL alloc] initWithString:urlContents]];

I use a textview to display a content, so ,

textview.text=urlContents1;


[/HTML]

But i cannot get result.

Can anybody please give me the code.
Regards
judy
iphonejudy is offline   0 Reply With Quote
Old Dec 11, 2008, 05:27 AM   #2
Pring
macrumors 6502
 
Join Date: Sep 2003
You need to provide more information about what's "not working". What have you tried so far to debug this?

Also don't use xxx.com as an example domain, it redirects to porn. http://www.example.com is reserved for the purpose of examples, use that.
__________________
Dardan Software
Neil Inglis' Blog
Check out Escape Pod and Alphonetic on iTunes!
Pring is offline   0 Reply With Quote
Old Dec 11, 2008, 10:15 AM   #3
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
On first pass, I see a problem with your urlContents string creation.

Code:
NSString *urlContents =	[NSString stringWithFormat:
				        @"http://www.xxx.com/xxx.aspx?country=? 
                                        %@",code ];
What is with the "country=?" ? That is going to generate "country=?100", for example.

Try this instead:

Code:
NSString *urlContents =	[NSString stringWithFormat:
				        @"http://www.xxx.com/xxx.aspx?country=%@", 
                                        code ];
dejo is offline   0 Reply With Quote
Old Dec 12, 2008, 02:53 AM   #4
iphonejudy
Thread Starter
macrumors 6502
 
Join Date: Sep 2008
Thanks.I finished
iphonejudy is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Framerate problem with XSplit, League of Legends, & BOOTCAMP on 2011 Macbook Pro superkrups20056 Mac and PC Games 0 Oct 11, 2011 06:42 PM
List the content of a web folder in iOS gameplayerxp iPhone/iPad Programming 3 Jun 17, 2011 09:48 AM
Problem in the size of the view of ipad Binju iPhone/iPad Programming 14 Apr 20, 2010 09:44 AM
Language display problem in "Kind" field of Finder (in List View) macuser84 Mac Applications and Mac App Store 0 Jul 16, 2009 03:32 PM
Problem in accessing value of variable of a parent class iphonejudy iPhone/iPad Programming 8 Mar 1, 2009 09:06 AM


All times are GMT -5. The time now is 02:25 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC