Skip to content

Instantly share code, notes, and snippets.

pchatterjee

Block or report user

Report or block pchatterjee

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View books.xml
<books>
<book id="5">
<title>Introduction to XQuery</title>
<description>A beginner's guide to XQuery that covers sequences and FLOWR expressions</description>
<type>softcover</type>
<sales-count>155</sales-count>
<price>19.95</price>
</book>
<book id="17">
<title>Document Transformations with XQuery</title>
View dom_example.php
<?php
$wines = new DOMDocument();
$wines->load( 'wines.xml' );
$categorys = $wines->getElementsByTagName("category");
foreach( $categorys as $category ) {
echo "<p>";
$name = $category->getAttribute("name");
echo "<b>Type: $name</b><br/>";
View index.php
<?php
@date_default_timezone_set("GMT");
# params array
define('PARAMS', array('to', 'from', 'amnt', 'format'));
# error_hash to hold error numbers and messages
define ('ERROR_HASH', array(
1000 => 'Required parameter is missing',
1100 => 'Parameter not recognized',
View index.php
<?php
@date_default_timezone_set("GMT");
# params array
define('PARAMS', array('to', 'from', 'amnt', 'format'));
# error_hash to hold error numbers and messages
define ('ERROR_HASH', array(
1000 => 'Required parameter is missing',
1100 => 'Parameter not recognized',
View index.php
<?php
@date_default_timezone_set("GMT");
# params array
define('PARAMS', array('to', 'from', 'amnt', 'format'));
# error_hash to hold error numbers and messages
define ('ERROR_HASH', array(
1000 => 'Required parameter is missing',
1100 => 'Parameter not recognized',
View index.php
<?php
@date_default_timezone_set("GMT");
define('PARAMS', array('to', 'from', 'amnt', 'format'));
if (!isset($_GET['format']) || empty($_GET['format'])) {
$_GET['format'] = 'xml';
}
# ensure PARAM values match the keys in $GET
View get.php
$from = $_GET['from'];
$to = $_GET['to'];
$amnt = $_GET['amnt'];
$format = $_GET['format'];
View get_rates_xml.php
<?php
@date_default_timezone_set("GMT");
if (file_exists('rates.xml')) {
copy('rates.xml', 'rates'.'_'.time().'.xml');
$xml = simplexml_load_file('rates.xml');
foreach($xml->rate as $r) {
if ((string) $r['live'] == '1') {
$live[] = (string) $r['code'];
}
View TwitterAPIExchange.php
<?php
/**
* Twitter-API-PHP : Simple PHP wrapper for the v1.1 API
*
* PHP version 5.3.10
*
* @category Awesomeness
* @package Twitter-API-PHP
* @author James Mallison <me@j7mbo.co.uk>
* @license MIT License
View quotes.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Quotes XML -&gt; HTML using XSLT example</title>
<style>
tr:nth-child(odd){
background-color:#eeeeee;
}
You can’t perform that action at this time.