Using require_once( 'http://www.example.com/wordpress/wp-load.php' );
Won't work from external locations even if you allow_url_include
. Your server still parses the php file and sends the parsed php which would end up being completely blank.
What you need to do is create an API. You will probably want to create a Wordpress plugin that creates a new url that Piwik can query to get the results.
A super simple api on the Wordpress server could look like this:
/api.php
<?php
// TODO add authentication, probably token-based
// TODO move this to a WP plugin
include ('wp-load.php');
// Get count of published posts
$count = array(
'count' => wp_count_posts()->publish
);
echo json_encode($count);
PIWIK SITE
<?php
$data = json_decode(file_get_contents('http://www.example.com/wordpress/api.php'));
echo $data->count;
// Result: number of published posts