Retrieving a protected page with HTTP_Request

<?php $r = new HTTP_Request(’http://www.w3mentor.com/protect.php’); $r->setBasicAuth(’username’,’password’); $r->sendRequest(); $page = $r->getResponseBody();
Continue reading…

Enjoyed this post? Share it!

 
 

PHP Quote Escaping In Backreference Replacements – String Function

<?php $html = "<code>&lt;b&gt; It’s bold &lt;/b&gt;</code>"; print preg_replace(’@<code>(.*?)</code>@e’,"html_entity_decode(‘$1’)", $html); print "\n";$html = ‘<code>&lt;i&gt; "This" is italic. &lt;/i&gt;</code>’; print preg_replace(’@<code>(.*?)</code>@e’,"html_entity_decode(‘$1’)", $html); print "\n"; ?>
Continue reading…

Enjoyed this post? Share it!