sal002 (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 03, 2013, 12:33:34 PM |
|
I need a quick and dirty PHP script written that scrapes the highest price for converting Bytecoin into BTC as posted here - http://exchange.bytecoin.in/. Any takers?
|
|
|
|
bitcoinator
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 03, 2013, 01:21:33 PM |
|
Should it consider amount of bte to be converted?
|
|
|
|
sal002 (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 03, 2013, 01:40:11 PM |
|
Nope - just get the price. SImple scraper.
|
|
|
|
bitcoinator
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 03, 2013, 01:42:19 PM |
|
Sounds simple, I will do it.
|
|
|
|
Chemicalbro
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 03, 2013, 02:07:22 PM |
|
<?php $url = " http://exchange.bytecoin.in/"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $curl_scraped_page = curl_exec($ch); curl_close($ch); preg_match_all("|<[^>]+>(.*)</[^>]+>|U", $curl_scraped_page, $out); echo "Max buy: " . $out[1][10] . "\n"; ?>
|
|
|
|
sal002 (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 03, 2013, 02:14:45 PM |
|
Genius - can I send you a small tip?
|
|
|
|
Chemicalbro
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 03, 2013, 02:20:16 PM |
|
Sure, if you like. Just note that if the page changes format (ie. more tags, etc get inserted before the buy price), that quick grab will break. You'd have to change the array number to match the change.
1HcNqP6uzqEcmsNe4uDu38qDWXonU2z6ci
|
|
|
|
bitcoinator
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 03, 2013, 02:27:31 PM |
|
Oh, wow... Really genious... Here is my solution since I did it too: <?php function get_max_price_from_table($table){ $max_price = 0; $rows = $table->getElementsByTagName('tr'); for ($i = 1; $i < $rows->length; $i++) $max_price = max($rows->item($i)->getElementsByTagName('td')->item(0)->nodeValue, $max_price); return $max_price; } $html = file_get_contents("http://exchange.bytecoin.in/"); $DOM = new DOMDocument; $DOM->loadHTML($html); $tables = $DOM->getElementsByTagName('table'); echo get_max_price_from_table($tables->item(1)); ?> Just in case if you decide to tip: 1Hn7xud8i8pn7WSTNmHzjYe7gLz1XmpTQH ![Smiley](https://bitcointalk.org/Smileys/default/smiley.gif)
|
|
|
|
sal002 (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 03, 2013, 02:29:05 PM |
|
Good as well ![Smiley](https://bitcointalk.org/Smileys/default/smiley.gif) !
|
|
|
|
Chemicalbro
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 03, 2013, 02:31:56 PM |
|
I'd actually go with his, mine is REALLY quick and dirty, his is a little less so :p
|
|
|
|
sal002 (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 04, 2013, 12:00:23 AM |
|
Thank you both - tips sent.
|
|
|
|
bitcoinator
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 04, 2013, 05:12:55 AM |
|
Oh, wow, I am bitcoiner now, thanks! ![Smiley](https://bitcointalk.org/Smileys/default/smiley.gif)
|
|
|
|
dooglus
Legendary
Offline
Activity: 2940
Merit: 1333
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 25, 2013, 04:00:02 AM |
|
Here's my version. It's quicker because it avoids using the network at all: <?php
print "We are in maintenance. Please come back later\n";
|
Just-Dice | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | Play or Invest | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | 1% House Edge |
|
|
|
sal002 (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 25, 2013, 04:26:47 AM |
|
Here's my version. It's quicker because it avoids using the network at all: <?php
print "We are in maintenance. Please come back later\n"; +1 - well, it worked for a bit!
|
|
|
|
dooglus
Legendary
Offline
Activity: 2940
Merit: 1333
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 25, 2013, 04:40:23 AM |
|
+1 - well, it worked for a bit!
Still works for me. ![Smiley](https://bitcointalk.org/Smileys/default/smiley.gif) In the same series, here's a script that will tell you what time it is: Inspired by the goon show.
|
Just-Dice | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | Play or Invest | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | 1% House Edge |
|
|
|
|