How to access PHP echo data from a Swift application?

I have a PHP page that has several JSON:

echo json_encode("Hello");

How can I access this in my quick application? I used the method to get the data from the website before, when I printlnreturned the data, it just prints all the HTML for the website (including tags).

    let url = NSURL(string: myLinkUrl)
    let request = NSURLRequest(URL: url!)

    NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue()) {(response, data, error) in
        println(NSString(data: data, encoding: NSASCIIStringEncoding)) //Prints HTML code
    }

I would like to know how to print only data that displays an echo (in this case, "Hello")

+4
source share
1 answer

, , json php-. html. Json -, . php json.

<?php
 $response['data']="Hello";
 echo json_encode("Hello");
?>
0

All Articles