Skip to content

PHP get the current money quote

by Vinícius Krolow on agosto 16th, 2010

A simple example to get the money quote using the Finances of yahoo. In the example Euro to Reais.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
< ?php
	function get_content($url) {
		$ch = curl_init();
		$timeout = 5; 
		curl_setopt ($ch, CURLOPT_URL, $url);
		curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
		$file_contents = curl_exec($ch);
		curl_close($ch);
 
		return $file_contents;
	}
 
      	setlocale(LC_MONETARY, 'pt_BR');
	$euro = explode(',', get_content('http://download.finance.yahoo.com/d/quotes.csv?s=EURBRL=X&f=sl1d1t1ba&e=.csv'));
 
	echo '1 euro vale R$ ' . money_format('%i', $euro[1])  . '. Atualizado às '. $euro[3] .' Fonte: Yahoo Finances';
?>

With this code I made two twitter accounts to inform to me the money quote those are, cotacaoeuro and cotacaodollar.

From → php

7 Comments
  1. A staff restaurant teenmodel toplist
    =-)

  2. Can you put it on the scales, please? top 100 nn models
    kpcclv

  3. Good crew it’s cool :) Young Little Toplist 39990

  4. How much notice do you have to give? Dorki Rompl Porn :D D

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS