I'm running into a weird issue here.
This is my first time making a database, coding PHP and pulling the output from ios app (Objective c). I was following a tutorial in swift however and I translated the code successfully.
I created a sample data table with 2 columns, queried them with a PHP script and placed it in my webroot directory. The path is http://haiticonnect.epizy.com/GetVotes.php
and when I paste it into chrome, the page displays my records.
Checking the source code of the page also delivers this exact output.
[{"id":"firstid","post_id":"1"},{"id":"secondid","post_id":"2"}]
My issue is in my objective c code, when I try to grab data with [NSData dataWithContentsOfUrl:myUrl] it always reaches a page that says that the browser does not support javascript. So from the mac, I disable javascript in safari, pasted the url but it shows the correct page.
Can anyone explain why dataWithContentsOfUrl
sees javascript?
#define JSON_URL @"http://haiticonnect.epizy.com/GetVotes.php"
NSURL *blogURL = [NSURL URLWithString:JSON_URL];
NSData *jsonData = [NSData dataWithContentsOfURL:blogURL];
const unsigned char *ptr = [jsonData bytes];
for(int i=0; i<[jsonData length]; ++i) {
unsigned char c = *ptr++;
NSLog(@"char=%c hex=%x", c, c);
}
I use this algorithm to print every single character it finds, but its only a string saying the my browser does not support javascript.