roxen.lists.roxen.general

Subject Author Date
Re:_[roxen.com_#8493]_En_fråga_angående_PHP_i Peter_Jönsson <peter[at]kolumn[dot]se> 27-11-2006
 _roxen
Hej,

Just took a short look and indeed as you say it is not possible to  
return any headers directly from the php script (it is the server  
that sets the headers and the cgi-php output is just a part or the  
whole of the page contents). Using php in Roxen (or anywhere :) is  
not really my cup of tea but what you could do is to return rxml  
<header>-tags instead and let the roxen cgi-module rxml-parse the  
output from php and in this way set  the headers and return the pdf- 
contents. This is of  course assuming that you run php as a cgi...

In practice (example):
Replace		 header('Content-Type: application/pdf')
with			echo('<header name="Content-Type" value="application/pdf'"/>')
in the php script and have the cgi-module set to rxml-parse the  
returned cgi-contents. Fingers crossed- not tested ;)

Another and perhabs better solution is to let the Output function  
save the pdf as a regular file and return the path to a webpage and  
either create a normal link to the file or redirect to a page that  
fetches the pdf and returns it to the client.

It is not exactly clear what behavior you want from your app and  
where in the process you get the error but I hope this can help  
somewhat. Please let us know if you have any progress

//peter




On 26 nov 2006, at 17.16, Magnus Andersson wrote:

>  Mitt namn är Magnus Andersson och jag är med och är ansvarig för
>  hemsidan till D-sektionen på Linköping universitet.
>  Vi har ett problem med att använda PHP tillsammans med roxen som vi
>  inte lyckats lösa och vi har provat det mesta.
>  Problemet är att det itne går att skicka Content-Type från php,  
> det är
>  så att jag ska skapa en dynamisk PDF i PHP och behöver då skicka en
>  content-type till webbläsaren, och nu går inte det så det blir
>  script-error när jag går in på sidan.
>
> Blev tipsad om denna mailinglista så jag ger den ett försök,  
> bifogar koden så ni ser hur det ser ut.
> Går att fixa?
> <fpdf.php>
> <generate_pdf.php>