Skip to content

Instantly share code, notes, and snippets.

// set location of docx text content file
$xmlFile = $targetDir."/word/document.xml";
$reader = new XMLReader;
$reader->open($xmlFile);
// set up variables for formatting
$text = ''; $formatting['bold'] = 'closed'; $formatting['italic'] = 'closed'; $formatting['underline'] = 'closed'; $formatting['header'] = 0;
// loop through docx xml dom
while ($reader->read()){
// set location of docx text content file
$xmlFile = $targetDir."/word/document.xml";
$reader = new XMLReader;
$reader->open($xmlFile);
// set up variables for formatting
$text = ''; $formatting['bold'] = 'closed'; $formatting['italic'] = 'closed'; $formatting['underline'] = 'closed'; $formatting['header'] = 0;
// loop through docx xml dom
while ($reader->read()){
<html>
<head>
<script type="text/javascript">
//<[CDATA[
window.addEvent('domready', function(){
// onload functions here
});
function overlay() {
el = document.getElementById("overlay");
<?php
/**
* Adding Cache Headers and ETag to example: http://sperling.com/examples/pcss/
*/
class PHPStyle
{
public static function setHeaders($filename="style.css",$type="text/css")
<?php
$url="http://thehilolowdown.blogspot.com/feeds/posts/default?max-results=1";
$_c = curl_init();
curl_setopt($_c, CURLOPT_URL, $url);
curl_setopt($_c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($_c, CURLOPT_TIMEOUT, 3);
//curl_setopt($_c, CURLOPT_USERPWD, "$_user:$_pass");
//curl_setopt($_c, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$_data = curl_exec($_c);
$response= curl_getinfo($_c);
<?php
/**
* Use whatever method you like to grab your HTML string. We'll use a site I mentioned in this post
* as an example.
*/
$remote_site_data = file_get_contents('http://www.10stripe.com/articles/automatically-generate-table-of-contents-php.php');
$dom_document = new DomDocument();
@$dom_document->loadHTML($remote_site_data);
$headers = $dom_document->getElementsByTagName('h2');
foreach ($headers as $header) {