How to use the API? - Not as a plugin?


Well my previous topic has resulted in 1 comment about file paths which despite correcting has made no difference. Although i randomly get a 200 status code (other times a 500 - with no change in code) I thought i would post again.

How on earth do you use the API in your own php scripts?

I am asking this somewhat straight forward question for a reason. On this page: it is clearly stated that

If you want to request data in a PHP script that is on the same server as Piwik, you can use this simple technique. This is a more efficient solution as it doesn’t require network calls. You directly call the PHP Piwik runtime and get the PHP data structure back.

If you are developing a plugin, you have to use this technique.

I am not developing a plugin! I am trying to use piwik from a directory above the /piwik directory and it refuses to do anything. The few times i get a 200 status code i still get nothing in the database. Other times i will see xml returned with a chrome:// protocol and some gibberish about a parser error.

Please could someone post a simple code sample on how to use piwik in their php which is NOT a plugin?