FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Using a heredoc in PHP as in Perl
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Using a heredoc in PHP as in Perl [message #171907 is a reply to message #171893] Thu, 20 January 2011 19:38 Go to previous messageGo to previous message
P E Schoen is currently offline  P E Schoen
Messages: 86
Registered: January 2011
Karma:
Member
"Captain Paralytic" wrote in message
news:c10032d0-d131-4484-8f22-c4178ddac2f1(at)g26g2000vbi(dot)googlegroups(dot)com...

> Either do it ALL in php or ALL in perl. Why mix the 2?

The HTMLpurifier is PHP:

<?php
require_once '../../library/HTMLPurifier.auto.php';
$config = HTMLPurifier_Config::createDefault();
$config->set('Core.Encoding', 'UTF-8'); // replace with your encoding
$config->set('HTML.Doctype', 'XHTML 1.0 Transitional'); // replace with
your doctype
$purifier = new HTMLPurifier($config);
$html = '<b>Simple and short'; // untrusted input HTML
$pure_html = $purifier->purify($html);
echo '<pre>' . htmlspecialchars($pure_html) . '</pre>';
?>

But my EventProcessor is in Perl. It might be worthwhile to rewrite it in
PHP, but there's another learning curve. I've seen pros and cons about each
language, and I chose Perl.

I need to add authentication to the server side, and my Perl script is in
the cgi-bin folder with permissions 711 where it can't be seen. I'm running
the PHP script in another folder and it has permissions 755. I suppose the
PHP document could be in the cgi-bin folder?

BTW, I found that my problem was related to a minor difference in syntax
between Perl and PHP for heredocs.

//But this does not work. Can't have semicolon after first EOF
// $str1 = <<<EOF;

www.pauleschoen.com/SCGBG/ErrorPHP.php

It was hard to find because I had it written correctly in one instance but
not the other, and the entire script failed.

Thanks.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Placing an URL in email
Next Topic: HOW TO MAKE MONEY ONLINE? MOST RICH PEOPLE ACHIEVE FROM FOREX
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 18:22:49 GMT 2024

Total time taken to generate the page: 0.03651 seconds