Note that there are some explanatory texts on larger screens.

plurals
  1. POProcess the greater than (>) on an HTML file with PHP-parsing
    text
    copied!<p>I have enabled PHP-parsing on my <code>.html</code> files and on one of my forms I'm using <a href="http://code.google.com/p/recaptcha/" rel="nofollow">Google recaptcha</a>.</p> <p>The recaptcha has the followwing code:</p> <pre><code>... if ($_POST["recaptcha_response_field"]) { $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if ($resp-&gt;is_valid) { echo "You got it!"; } else { $error = $resp-&gt;error; } } ... </code></pre> <p>The code got stuck on this part, <code>if ($resp-&gt;is_valid)</code> because of the greater than sign.</p> <p>How can I escape that?</p> <p>.</p> <p><em><strong>EDIT</em></strong></p> <p>Sorry for the question, I found out that the error was not because of HTML terminating the code when it encountered the greater than sign but was because PHP is not really parsing on the page. The process I did to enable parsing of PHP on HTML files is thru adding the following code on my <code>.htaccess</code></p> <pre><code>AddHandler php5-script .html </code></pre> <p>I added and tested the code locally and PHP was working but the captcha did not show of course because the private/public keys for recaptcha is for the domain I'm working on. I uploaded the <code>.htaccess</code> on the domain server and when I loaded the page it showed the following text:</p> <pre><code>is_valid) { echo "You got it!"; } else { $error = $resp-&gt;error; } } </code></pre> <p>At that point, I thought it was an issue with HTML breaking my code when it encountered the greater than sign.</p> <p>So the problem really is the code below that does not work on the server but worked locally.</p> <pre><code>AddHandler php5-script .html </code></pre> <p>I found other ways to enable PHP-parsing on HTML files such as:</p> <pre><code>AddType application/x-httpd-php html </code></pre> <p>But this was problematic, when I visited the page it's prompting me to download or save the file. There is a workaround I read on a forum to edit something on httpd.conf file but I can't really get my hands on that file (I'm access denied). So u-uhm. Sigh.</p> <p>Apologies and thanks for the replies.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload