NSWiki talk:Population extension

From NSwiki, the NationStates encyclopedia.
Jump to: navigation, search

To try this out on my own, I copied the code used in the function into a new php file, replaced the parameter with a GET input and the return with an echo command. Thus the start of it now runs:

$fileName = "http://www.nationstates.net/cgi-bin/nationdata.cgi/nation=".$_GET['nation'];

and the end is

echo $output

I also replaced the following line

$val = str_replace($open, , $val);

with

$val = str_replace($open, "" , $val);

because I got a parsing error otherwise (the aim was apparently to delete the opening tag from the value, and it does that now by replacing it with an empty string).

The following URL will display, via the echo command, the population of the nation entered:

[1]

So I've managed to get out one error, but the error messages I saw on here appear to be related to the fopen() command, not to the one I took out. I could't replicate those in my test, so I guess it has to do with some server settings (which I have no clue about). Arancaytar 11:05, 18 Dec 2004 (GMT)

Ouch.

It appears that 'syntax error' was caused by wiki formatting. Seems like '' will result in italic text . So in effect I didn't do anything productive, beyond finding out that the code works perfectly in a different place than the wiki. Arancaytar 13:14, 18 Dec 2004 (GMT)