Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 798911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:02:41+00:00 2026-05-14T23:02:41+00:00

I am planning to make an iPhone search app. the user types in the

  • 0

I am planning to make an iPhone search app. the user types in the search string. the string will be searched by some search engines like Google, Live, Yahoo …

I need to get the search result in the XML format. Is there any way to do this. Help needed. Please.

Thanks and regards,
Shibin

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T23:02:42+00:00Added an answer on May 14, 2026 at 11:02 pm

    A RESTful search request to Google AJAX returns a response in JSON format. JSON is a like a very highly stripped-down version of XML.

    Google doesn’t make its SOAP interface available any longer, so I don’t know if you’ll be able to get XML from them, at least through a public interface. Luckily for you, JSON responses are trivial to request and to parse on the iPhone.

    You can issue the request with ASIHTTPRequest and parse the JSON-formatted response on an iPhone with json-framework.

    For example, to create and submit a search request that is based on the example on the Google AJAX page, you could use ASIHTTPRequest’s -requestWithURL and -startSynchronous methods:

    NSURL *searchURL = [NSURL URLWithString:@"http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=Paris%20Hilton"];
    ASIHTTPRequest *googleRequest = [ASIHTTPRequest requestWithURL:searchURL];
    [googleRequest addRequestHeader:@"Referer" value:[self deviceIPAddress]]; 
    [googleRequest startSynchronous];
    

    You would build the NSURL instance based on your search terms, escaping the request parameters.

    If I followed Google’s example to the letter, I would also add an API key to this URL. Google asks that you use an API key for REST searches. You should sign up for an API key over here and add it to your requests.

    You should also specify the referer IP address in the request header, which in this case would be the local IP address of the iPhone, e.g.:

    - (NSString *) deviceIPAddress {
        char iphoneIP[255];
        strcpy(iphoneIP,"127.0.0.1"); // if everything fails
        NSHost *myHost = [NSHost currentHost];
        if (myHost) {
            NSString *address = [myHost address];    
            if (address)
                strcpy(iphoneIP, [address cStringUsingEncoding:NSUTF8StringEncoding]);
        }
        return [NSString stringWithFormat:@"%s",iphoneIP]; 
    }
    

    There are also asynchronous request methods which are detailed in the ASIHTTPRequest documentation. You would use those to keep the iPhone UI from getting tied up while the search request is made.

    In any case, once you have Google’s JSON-formatted response in hand, you can use the json-framework SBJSON parser object to parse the response into an NSDictionary object:

    NSError *requestError = [googleRequest error];
    if (!requestError) {
        SBJSON *jsonParser = [[SBJSON alloc] init];
        NSString *googleResponse = [googleRequest responseString];
        NSDictionary *searchResults = [jsonParser objectWithString:googleResponse error:nil];
        [jsonParser release];
        // do stuff with searchResults...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am planning to make a web app which will eventually use Cassandra .
I am planning to make a universal app to support retina display. It will
I am planing to make an app for iPhone I want to include some
I want to make an iPhone app, but I am planning to make the
I am planning to make a mmo game like iMobsters from Storm8. There will
I am planning to make an iPhone web application and I just wanted to
I have a Core Data app that will end up being an iPhone/iPad universal
Im planning to make my next app 3.0 only (with Core Data). Does anyone
We are planning to make some of the tables audit enabled in our Rails3
I am planning to make a project management with PHP/MySQL/Codeigniter. It will have 10

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.