How do I give inputs through NSURL

46 views Asked by At

I am attempting to enter a song title into a website's search bar using NSURL. The website is an MP3 website however it uses the POST function. I also am not sure of how I would go about downloading the MP3 file. I need to select the search button and select the download button on a website in the background without the user giving any inputs. I am unsure of how to do this as all that I have done so far is be able to print out the websites html. My code is below but once again this is what I need to do on this website.

navigate to website

enter song info

find song

download

To better understand what I am trying to say it may help to go to the website below in my code.

let url = NSURL(string: "http://www.mp3juices.cc/")

    let task = NSURLSession.sharedSession().dataTaskWithURL(url!) {(data, response, error) in
        println(NSString(data: data, encoding: NSUTF8StringEncoding))
    }

    task.resume()
1

There are 1 answers

2
Duncan C On BEST ANSWER

The likely answer is "You can't." There is no secret sauce that lets you generate a URL that fills in fields in a web page. If the website you are using isn't designed to prepopulate the search field with a parameter from an URL then you won't be able to do it. You might want to contact the company that runs the website you're using and ask them if what you want to do is possible.