Forum How do I...?

Call from other server

lindm
I have my basic page on one server but want to keep prince on another server. I get errors when trying to call Prince from another server. How should this be handled?

Part of my current conversion script:



error_reporting(E_ALL ^ E_NOTICE); 
ini_set("display_errors", 1); 

require_once("/Library/WebServer/Documents/htdocs/prince/prince.php"); 


$oPrince = new Prince("/Library/WebServer/Documents/htdocs/prince/bin/prince"); 


$oPrince->setHTML(true); 
$oPrince->setLog("/Library/WebServer/Documents/htdocs/prince/prince.log"); 
$oPrince->addStyleSheet("/Library/WebServer/Documents/htdocs/phptest2/css/print.css"); 


$iType = 0; 

if($iType == 0) 
{ 
   header("Content-Type: application/pdf"); 
   header("Content-Disposition: attachment; filename=AR".notyr(CYstart,CYfin).".pdf"); 

   chdir("/Library/WebServer/Documents/htdocs/prince/bin/"); 

   $bSuccess = $oPrince->convert3($stringData); 

   echo ($bSuccess ? "Success<br>\n" : "Failure<br>\n"); 
} 
else 
{ 
   $bSuccess = $oPrince->convert2($_SERVER['HTTP_REFERER'], "/tmp/test.pdf", $aMessages); 
header("Location: /tmp/test.pdf");

   echo ($bSuccess ? "Success<br>\n" : "Failure<br>\n"); 

   echo "<pre>"; 
   var_dump($aMessages); 
   echo "</pre>"; 
} 
}

exit();
?>
mikeday
What errors do you get? When you say you want to call Prince from another server, do you mean you want to do a HTTP request to that other server to get the PDF back, or something else?
lindm
Hi,

I have my php script on http://www.something.com but the princescript on http://www.somethingelse.com. I thought of changing this on the

require_once("/Library/WebServer/Documents/htdocs/prince/prince.php");

to

require_once("http://www.somethingelse.com/htdocs/prince/prince.php");
mikeday
You will need to have Prince itself installed on something.com in that case.