Jump to content
We've recently updated our Privacy Statement, available here ×

please give me a simple example


ruscosmin

Recommended Posts

 

I tried to use the PHP extension following the "PHP Client - Sample Code" but without success...

I don't know java and I'm new in PHP.

Anyway... I found very intersting this tool.

I tried something besic but I failed. This is what I tried:

 


require_once "JasperClient.php";

$client = new JasperJasperClient('http://server_address', // Hostname
                8080, // Port
                'jasperadmin', // Username
                'jasperadmin', // Password
                '/jasperserver'); // Base URL

$report = $client->runReport('/reports/samples/AllAccounts', 'html');
echo $report;

 

and the error:

[Thu Jan 24 07:05:08 2013] [error] [client 188.27.149.158] PHP Fatal error:  Uncaught exception 'Jasper\RESTRequestException' with message 'Unexpected HTTP code returned: 0' in /var/www/html/client/JasperClient.php:135nStack trace:n#0 /var/www/html/client/JasperClient.php(563): Jasper\JasperClient->prepAndSend('http://127.0.0....', Array, 'GET', NULL, true)n#1 /var/www/html/client/test.php(6): Jasper\JasperClient->runReport('/reports/sample...', 'html')n#2 {main}n  thrown in /var/www/html/client/JasperClient.php on line 135

 

I found this site:

http://www.simit.com.my/?q=phpjasperxml

which has a very good idea about php integration but unfortunattly is outdated

I can't pass my parameters to my reports when I use theirs solution.

 

PS

Please correct the article sintax from "PHP Client - Sample Code" .. it's messy

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Based on the code snippet below (copied from above), it looks like you didn't specify a valid hostname. Is this actually the parameter list you supplied?

$client = new JasperJasperClient('http://server_address', // Hostname
                8080, // Port
                'jasperadmin', // Username
                'jasperadmin', // Password
                '/jasperserver'); // Base URL

 

Link to comment
Share on other sites

of course not... I used 127.0.0.1, localhost and the real IP ( I tried all combination from windows and linux, remote and local ) :D

jasper server was installed the following system:

OS: centos 6.2

Apache 2.0

# php -version
PHP 5.3.3 (cli) (built: Jul  3 2012 16:53:21)
Copyright © 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright © 1998-2010 Zend Technologies

# pear install SOAP
pear/SOAP is already installed and is the same as the released version 0.13.0
install failed

# pear install Net_Dime
pear/Net_Dime is already installed and is the same as the released version 1.0.2
install failed

First I tried the sample app... but after I log in all that I see is an empty directorry:

List report

Current Directory: /
[..]




Exit

with the following log from httpd:

[Fri Jan 25 04:10:19 2013] [error] [client ..... ] PHP Notice:  Undefined index: uri in /var/www/html/php-sample/listReports.php on line 15
[Fri Jan 25 04:10:19 2013] [error] [client ..... ] PHP Warning:  DOMDocument::loadXML(): Start tag expected, '<' not found in Entity, line: 1 in /var/www/html/php-sample/client.php on line 300
 

Maybe I missed some configurations... Also, I tried on windows with XAMPP but it give me tons of errors and warnings.

Any sugestions?


 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...