Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //!alias add currency web title http://www.cgraphic.dk/currency.php?val=$1&from=$2&to=$3
- $title = ":)";
- if(isset($_GET['from']) && isset($_GET['to']) && isset($_GET['val'])){
- $from = $_GET['from'];
- $to = $_GET['to'];
- $val = $_GET['val'];
- $link = 'http://www.x-rates.com/calculator/?from='.$from.'&to='.$to.'&amount='.$val;
- $doc = new DomDocument;
- $doc->validateOnParse = true;
- $doc->loadHtml(file_get_contents($link));
- $spans = $doc->getElementsByTagName('span');
- $count = 0;
- foreach ($spans as $book) {
- if($count==3){
- echo $book->nodeValue. ' ' .$count.'<br>';
- $title = $book->nodeValue;
- }
- if($count==6 && $book->nodeValue=='---'){
- $title = 'Eighter '.$from.' is not a valid currency, or wrong syntax. Example \'!currency 1 USD EUR\'';
- }
- if($count==5 && $book->nodeValue=='---'){
- $title = 'Eighter '.$to.' is not a valid currency, or wrong syntax. Example \'!currency 1 USD EUR\'';
- }
- $count++;
- }
- }
- ?>
- <html>
- <head>
- <title><?php echo htmlspecialchars($title);?></title>
- </head>
- <html>
Advertisement
Add Comment
Please, Sign In to add comment