Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Dec 11, 2008, 04: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, 06: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, 11: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 online now   0 Reply With Quote
Old Dec 12, 2008, 03: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

Similar Threads
thread Thread Starter Forum Replies Last Post
Accessing Military Web Mail on Mac Pro Lion funderchicken Mac Basics and Help 3 Jan 12, 2014 07:16 AM
Safari Web Content quit unexpectedly - Parental Controls problem with Google Docs Mal OS X 6 Aug 30, 2013 09:33 AM
Apple Applies for Patent on 'Audio Hyperlinking' to Facilitate Accessing Supplementary Podcast Content MacRumors MacRumors.com News Discussion 49 Aug 9, 2013 02:03 AM
Accessing a static variable from an instance method nerak99 iPhone/iPad Programming 25 Sep 13, 2012 12:26 PM
Resolved: protect the files and to decide is accessing their content dreamaker Mac Applications and Mac App Store 0 Sep 13, 2012 08:23 AM

Forum Jump

All times are GMT -5. The time now is 01:23 PM.

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

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