Bitcoin Forum

Bitcoin => Project Development => Topic started by: idev on February 08, 2011, 07:00:30 PM



Title: Php script to display ASK price on a website
Post by: idev on February 08, 2011, 07:00:30 PM
Anyone have a script to display ASK prices on my web site?
preferably in php.


Title: Re: Php script to display ASK price on a website
Post by: BitLex on February 08, 2011, 07:25:12 PM
how about this:
Code:
$mtg_url='http://mtgox.com/code/data/ticker.php';
$handle = fopen ($mtg_url, "r");
$output = fread($handle, 1024);
fclose($handle);
$obj = json_decode($output);
$bid = $obj->ticker->buy;
$ask = $obj->ticker->sell;

echo "bid: ".$bid." | ask: ".$ask;


Title: Re: Php script to display ASK price on a website
Post by: idev on February 08, 2011, 11:12:36 PM
how about this:
Code:
$mtg_url='http://mtgox.com/code/data/ticker.php';
$handle = fopen ($mtg_url, "r");
$output = fread($handle, 1024);
fclose($handle);
$obj = json_decode($output);
$bid = $obj->ticker->buy;
$ask = $obj->ticker->sell;

echo "bid: ".$bid." | ask: ".$ask;


Thanks a lot man, sent you 2.50bc for your time and effort.
Cheers  8)


Title: Re: Php script to display ASK price on a website
Post by: tiCeR on August 03, 2011, 10:29:13 AM
can someone tell me the hole working php script ? i not get it working ;(

thx pls private message me


Title: Re: Php script to display ASK price on a website
Post by: NothinG on August 03, 2011, 04:02:04 PM
can someone tell me the hole working php script ? i not get it working ;(

thx pls private message me
Code:
<?php
$mtg_url
='https://mtgox.com/code/data/ticker.php';
$handle fopen ($mtg_url"r");
$output fread($handle1024);
fclose($handle);
$obj json_decode($output);
$bid $obj->ticker{'buy'};
$ask $obj->ticker{'sell'};

echo 
"bid: ".$bid." | ask: ".$ask;
?>
:P


Title: Re: Php script to display ASK price on a website
Post by: brandon@sourcewerks on August 04, 2011, 12:10:52 AM
Take a look at the libraries I have created:

https://github.com/sourcewerks (https://github.com/sourcewerks)


Title: Re: Php script to display ASK price on a website
Post by: nhodges on August 05, 2011, 12:14:16 AM
how about this:
Code:
$mtg_url='http://mtgox.com/code/data/ticker.php';
$handle = fopen ($mtg_url, "r");
$output = fread($handle, 1024);
fclose($handle);
$obj = json_decode($output);
$bid = $obj->ticker->buy;
$ask = $obj->ticker->sell;

echo "bid: ".$bid." | ask: ".$ask;

If you're on an IIS server and opt to use the https protocol, the server will close the connection without sending close_notify, and PHP will report an error of "SSL: Fatal Protocol Error" ... for those of you on IIS :o please use file_get_contents or the cURL library.


Title: Re: Php script to display ASK price on a website
Post by: Xenland on August 05, 2011, 01:46:26 AM
Mining farm does some of the similar codes located in the blockUpdater.php file in side of the /req/cronjobs/ folder.


Title: Re: Php script to display ASK price on a website
Post by: idev on August 05, 2011, 02:42:59 PM
Take a look at the libraries I have created:

https://github.com/sourcewerks (https://github.com/sourcewerks)

How to fix this error please ?
Code:
Fatal error: Call to undefined function str_getcsv() in /home/user/public_html/bctest/bitcoinCharts.php on line 122



Title: Re: Php script to display ASK price on a website
Post by: Xenland on August 06, 2011, 04:18:33 AM
Take a look at the libraries I have created:

https://github.com/sourcewerks (https://github.com/sourcewerks)

How to fix this error please ?
Code:
Fatal error: Call to undefined function str_getcsv() in /home/user/public_html/bctest/bitcoinCharts.php on line 122



I dont use his software but it looks like you forgot to include() a file or require_once() a file either or should fix your prob


Title: Re: Php script to display ASK price on a website
Post by: indicasteve on August 06, 2011, 06:51:40 AM
You need PHP 5 >= 5.3.0 to use this function.

There are some workarounds here:
http://php.net/manual/en/function.str-getcsv.php (http://php.net/manual/en/function.str-getcsv.php)