This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| # error_hash to hold error numbers and messages | |
| # must be kept in the config file | |
| $error_hash = array( | |
| 1000 => 'Currency type not recognized', | |
| 1100 => 'Required parameter is missing', | |
| 1200 => 'Parameter not recognized', | |
| 1300 => 'Currency amount must be a decimal number', | |
| 1400 => 'Error in service', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| # always include this line (in config file in final version) | |
| @date_default_timezone_set("GMT"); | |
| # the function to generate errors (in functions file in final version) | |
| require_once('generate_error.php'); | |
| # exit if core data files are missing | |
| if (!file_exists('rates.xml') || !file_exists('currencies.xml')) { | |
| echo generate_error(1400, $error_hash, 'xml'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| # TESTS for catch_errors.php | |
| # Not enough params (format missing) | |
| # header('Location: catch_errors.php?from=USD&to=GBP&amnt=10.00'); | |
| # Too many params (other added) | |
| # header('Location: catch_errors.php?from=USD&to=GBP&amnt=10.00&format=xml&other=value'); | |
| # from param is not recognized |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "id": 2, | |
| "name": "An ice sculpture", | |
| "price": 12.50, | |
| "tags": ["cold", "ice"], | |
| "dimensions": { | |
| "length": 7.0, | |
| "width": 12.0, | |
| "height": 9.5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "$schema": "http://json-schema.org/draft-04/schema#", | |
| "title": "Product set", | |
| "type": "array", | |
| "items": { | |
| "title": "Product", | |
| "type": "object", | |
| "properties": { | |
| "id": { | |
| "description": "The unique identifier for a product", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <customers> | |
| <customer>id="75035578"> <name> | |
| <first>Joseph</first> | |
| <middle>Michael</middle> | |
| <last>Bloggs</last> | |
| <preferred>Joe</preferred> | |
| <title>Mr</title> | |
| </name> | |
| <address> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <customers> | |
| <customer>id="75035578"> <name> | |
| <first>Joseph</first> | |
| <middle>Michael</middle> | |
| <last>Bloggs</last> | |
| <preferred>Joe</preferred> | |
| <title>Mr</title> | |
| </name> | |
| <address> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>AJAX pull XML Example</title> | |
| <style> | |
| textarea { | |
| outline: none; | |
| resize: none; | |
| width: 400px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>AJAX pull XML Example</title> | |
| <style> | |
| textarea { | |
| outline: none; | |
| resize: none; | |
| width: 400px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>AJAX pull XML Example</title> | |
| <style> | |
| textarea { | |
| outline: none; | |
| resize: none; | |
| width: 400px; |