Jump to content

brucegregory

Members
  • Posts

    22
  • Joined

  • Last visited

Everything posted by brucegregory

  1. I can retrieve my account number correctly, but the other variables will not work with the same notation.
  2. Notice: Array to string conversion in C:\xampp\htdocs\bitcoin\mtgox.php on line 100 Notice: Undefined index: BTC in C:\xampp\htdocs\bitcoin\mtgox.php on line 100 USDS: Array BTCS: Sorrry. Im not new to PHP, but I have no idea how to do this and Google isnt helping me much like it usually does. Thank You
  3. I tried and I get errors everytime. Can you give me another hint? Please
  4. So now I have a return from an API with more than one array and I need to decode it to PHP variables again. <?php function cryptoxchange_query($path, array $req = array()) { // API settings $key = ' '; $secret = ''; // generate a nonce as microtime, with as-string handling to avoid problems with 32bits systems $mt = explode(' ', microtime()); $req['nonce'] = $mt[1].substr($mt[0], 2, 6); // generate the POST data string $post_data = http_build_query($req, '', '&'); // generate the extra headers $headers = array( 'cryptokey: '.$key, 'cryptopayload: '.base64_encode(hash_hmac('sha512', $post_data, base64_decode($secret), true)), ); // our curl handle (initialize if required) static $ch = null; if (is_null($ch)) { $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MtGox PHP client; '.php_uname('s').'; PHP/'.phpversion().')'); } curl_setopt($ch, CURLOPT_URL, 'https://cryptoxchange.com/api/v0/account/balance/?stamp=$mt'.$path); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // run the query $res = curl_exec($ch); if ($res === false) throw new Exception('Could not get reply: '.curl_error($ch)); $dec = json_decode($res, true); if (!$dec) throw new Exception('Invalid data received, please make sure connection is working and requested API exists'); return $dec; } // example 1: get infos about the account, plus the list of rights we have access to //var_dump(mtgox_query('0/info.php')); // old api (get funds) echo 'MtGox'; echo '<br/>'; var_dump(cryptoxchange_query('')); //$values = (cryptoxchange_query('')); //echo "USDS: ".$values['Balance'].' BTCS: '.$values['BTC']; // trade example // var_dump(mtgox_query('0/buyBTC.php', array('amount' => 1, 'price' => 15)));\ ?> Output: array(5) { ["AccountNumber"]=> string(18) "xxxxxxxxxxx" ["Balance"]=> array(4) { ["USD"]=> string(11) "47.42805318" ["AUD"]=> string(10) "0.00000000" ["BTC"]=> string(10) "7.15424820" ["NMC"]=> string(10) "0.00000000" } ["ReturnCodes"]=> int(1) ["err"]=> string(0) "" ["stamp"]=> string(3) "$mt" } Sorry for all the questions, Than You!
  5. Thank You so much! That worked exactly as exspected.
  6. <?php function mtgox_query($path, array $req = array()) { // API settings $key = '7583cda31885'; $secret = ''; // generate a nonce as microtime, with as-string handling to avoid problems with 32bits systems $mt = explode(' ', microtime()); $req['nonce'] = $mt[1].substr($mt[0], 2, 6); // generate the POST data string $post_data = http_build_query($req, '', '&'); // generate the extra headers $headers = array( 'Rest-Key: '.$key, 'Rest-Sign: '.base64_encode(hash_hmac('sha512', $post_data, base64_decode($secret), true)), ); // our curl handle (initialize if required) static $ch = null; if (is_null($ch)) { $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MtGox PHP client; '.php_uname('s').'; PHP/'.phpversion().')'); } curl_setopt($ch, CURLOPT_URL, 'https://mtgox.com/api/'.$path); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // run the query $res = curl_exec($ch); if ($res === false) throw new Exception('Could not get reply: '.curl_error($ch)); $dec = json_decode($res, true); if (!$dec) throw new Exception('Invalid data received, please make sure connection is working and requested API exists'); return $dec; } // example 1: get infos about the account, plus the list of rights we have access to //var_dump(mtgox_query('0/info.php')); // old api (get funds) var_dump(mtgox_query('0/getFunds.php')); // trade example // var_dump(mtgox_query('0/buyBTC.php', array('amount' => 1, 'price' => 15)));\ ?> OutPut : array(2) { ["usds"]=> string( "37.94073" ["btcs"]=> string(10) "6.44987703" } How do I maek 'usds' and 'btcs' into variables so I can echo $usds; Thank you so much for the help!
  7. I am developing a purchase ordering system for a factory. A new feature is to allow someone to duplicate a purchase order. I have divided the system into two parts: purchase order, and purchase order items. I have made it where someone can duplicate the purchase order, but I cannot figure out how to duplicate the items because their are usually more than 1 item per purchase order, but sometimes when they are duplicated he only wants some of the items. I am not expecting you to code this for me, I just need a general flow chart. Please Help, Thanks
  8. I have made a production schedule in PHP and I need to seperate the dates by every week. Starting with Sunday and ending with Saturday. Is this possible? Thanks!
  9. I know their is an error somewhere in this code, but I have looked for hours and found a few syntax errors. My code will not give back any errors, it will just simply not insert into the database. If you see anything please let me know. Thanks! <?php session_start(); $username=$_SESSION['username']; if($username==''){ header("location:http://192.168.2.2/login.php"); } $con = mysql_connect("localhost","root","pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("main", $con); mysql_query("INSERT INTO quote_sheet (customer, attn, phone, fax, date, part, description, material, shipping, exceptions, tool_deliver_qty, tool_delivery_price, production_delivery_qty, production_delivery_price, other01, other02, other03, quoted_by, grams, surf_area, tons, density, lbs_min_parts, vsp1, lbs_mil_min, percent1, percent3, vsp2, ton_press2, pcs_hour1, pcs_hour2, sintered1, sintered2, sec_1, sec_2, sec_3, sec_4, sec_5, sec_6, sec_7, sec_8, set_up_charges, manu_costs, comm, tool, spec, lbs_mil_min2 ) VALUES ('$_POST[customer]','$_POST[attn]','$_POST[phone]', '$_POST[fax]', '$_POST[date]','$_POST[part]', '$_POST[description]', '$_POST[material]','$_POST[shipping]', '$_POST[exceptions]', '$_POST[tool_delivery_qty]','$_POST[tool_delivery_price]', '$_POST[production_delivery_qty]', '$_POST[production_delivery_price]','$_POST[other01]', '$_POST[other02]', '$_POST[other03]','$_POST[quoted_by]', '$_POST[grams]', '$_POST[surf_area]','$_POST[tons]', '$_POST[density]', '$_POST[lbs_mil_parts]','$_POST[vsp1]', '$_POST[lbs_mil_min]', '$_POST[percent1]', '$_POST[percent3]', '$_POST[vsp2]','$_POST[ton_press2]', '$_POST[pcs_hour2]', '$_POST[sintered1]','$_POST[sintered2]', '$_POST[sec_1]', '$_POST[sec_2]','$_POST[sec_3]', '$_POST[sec_4]', '$_POST[sec_5]','$_POST[sec_6]', '$_POST[sec_7]', '$_POST[sec_8]','$_POST[set_up_charges]', '$_POST[manu_costs]', '$_POST[comm]', '$_POST[tool]', '$_POST[spec]', '$_POST[lbs_mil_min2]'"); mysql_close($con); echo 'Quote Successfully Inserted'; ?>
  10. Thank you for your help. I have fix my error with your advice!
  11. I have a very populated MYSQL database and I need to make it so that when a input field in a form is left blank it has N/A in the database. So my solution is to change all of the default fields to N/A, but I have well over 500 rows. If I change this will it change my already populated rows with data in them? Thanks
  12. I have a description field for a form and when it goes over 30 characters, the table row stretches into other fields. I think if I can make PHP echo a <br/> after 30 characters it may work... but how? Thanks in advance, Bruce
  13. Is it possible to put a multiplication problem in the mysql "default value" field? In my script I need to take the unit amount * quantity, I know how to do this in php, but can I just put my equation in the "default value" field in MYSQL and make it equal to another field?... Like excell? Thanks
  14. one of the values needs to be purchase_order_date, not purchase_order.
  15. So I need to add ' ' to each one in the VALUE query?
  16. This is probably some obvious error I have made, but I cannot figure it out. I have made a few pages and now I am debugging them. My first page is called insert_purchase_order.php; on this page a person will enter some data in fields and hit the insert button. Then, the data is passed to another page, but when I try to insert into mysql it does not give me any errors, but I have no new rows either. The code for my 2nd page: <?php session_start(); $action=$_GET[action]; if ($action==insert){ $randid=$_POST['randid']; $vendor=$_POST["vendor"]; $purchase_order_date=$_POST["purchase_order_date"]; $ship=$_POST["ship"]; $fob=$_POST["fob"]; $terms=$_POST["terms"]; $buyer=$_POST["buyer"]; $freight=$_POST["freight"]; $req_date=$_POST["req_date"]; $confirming_to=$_POST["confirming_to"]; $remarks=$_POST["remarks"]; $tax=$_POST["tax"]; $con = mysql_connect("localhost","root","pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("main", $con); mysql_query("INSERT INTO purchase_order (randid, vendor, purchase_order, ship, fob, terms, buyer, freight, req_date, confirming_to, remarks, tax) VALUES ($randid, $vendor,$purchase_order_date,$ship, $fob, $terms, $buyer, $freight, $req_date, $confirming_to, $remarks, $tax)"); mysql_close($con); echo 'Data Accepted...'; echo '<br/>'; echo 'P.O. Inserted Successfully'; }else{ echo 'Error... Please Contact Bruce.'; echo 'Bruce, no data was passed from the insert_purchase_order.php page.'; } ?> <a href="http://localhost/insert_purchase_order_items.php?po= <?php echo $randid; ?>">Insert Purchase Order Items</a> I have permissions and everything. Thanks
  17. This is a clip of my PHP file: <?php $con = mysql_connect($host,$username,$password); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db($database, $con); $result = mysql_query("SELECT * FROM purchase_order WHERE purchase_order_number=='$purchase_order_number'"); while($row = mysql_fetch_array($result)) { $vendor=$row['vendor']; $purchase_order_date=$row['purchase_order_date']; $ship=$row['ship']; $state=$row['state']; $fob=$row['fob']; $terms=$row['terms']; $buyer=$row['buyer']; $freight=$row['freight']; $req_date=$row['req_date']; $confirming_to=$row['confirming_to']; $remarks=$row['remarks']; $tax=$row['tax'] } // [i][u][b]<-- This is line 88 (The one with the error)[/b][/u][/i] ?> Thanks in advance!
  18. So I need to echo a row from my database with php, but where i need to echo is already inside an echo. This is my part of my code: $con = mysql_connect("$host","$username","$password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("main", $con); $result = mysql_query("SELECT * FROM Vendor"); while($row = mysql_fetch_array($result)) { //I need to echo right here .................. but I get a blank page when I try this. Please Help. echo '<option value=$row['vendor_id']>'; echo $row['vendor_id']; echo '</option>'; } mysql_close($con); Result: A Blank page. Thanks in advance!
  19. Ok. So I have an HTML website with 14 pages and an external CSS. This website is for a movie rental place like BlockBuster, but local and much smaller. I have to update it everyday , http://brucegregory.net/westmorelandvt , and as you can see I will have to move every block down 1 to put a new movie up. What I think would help: 1. Change all my pages to PHP with an admin panel. 2.I need help with the admin panel and a code that makes my movies on the index page move to the right once or move down to the left once every time I add a new movie. Can someone please help?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.