Bitcoin Forum
June 23, 2024, 06:41:31 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Прикрутить автоприем MtGox кодов и BitPay  (Read 1169 times)
AlexNeto (OP)
Hero Member
*****
Offline Offline

Activity: 658
Merit: 536


Z-pay.io


View Profile WWW
January 20, 2013, 11:02:03 PM
 #1

Ищу исполнителей для небольшего задания.

Требования: Php, MySQL, знание MtGox api, BitPay.

Обменник полуавтомат - автоматически принимать гокс коды, btc (через сторонний процессинг).
Либо писать с нуля, либо запилить на какой-нибудь Joomla+BreezingForms например.

ТЗ еще нет, писать буду консультируясь с исполнителем.


Рассмотрю различные варианты сотрудничества. В идеале было бы долевое партнерство - с вас техническая реалиация и поддержка, с меня финансовая сторона, продвижение.

В личку пишите.

🔥Z-pay.io🔥 - Anonymous bitcoin cheques. FREE mixing.

☝️             ☝️                 ☝️
AlexNeto (OP)
Hero Member
*****
Offline Offline

Activity: 658
Merit: 536


Z-pay.io


View Profile WWW
January 24, 2013, 02:05:54 AM
 #2

Надо срочно.

Хотя бы просто обработка MtGox redeemable code. Оставим на потом все остальное.
Кто шарит в MtGox API?
0/redeemCode.php


🔥Z-pay.io🔥 - Anonymous bitcoin cheques. FREE mixing.

☝️             ☝️                 ☝️
Yurock
Sr. Member
****
Offline Offline

Activity: 462
Merit: 250


View Profile
January 28, 2013, 06:28:35 PM
 #3

Хотя бы просто обработка MtGox redeemable code.
Code:
<?php
$ratio 
1;
$mail = array (
 
'from' => '',
 
'to' => '',
 
'subject' => '',
 
'parameters' => '',
);
$mtgox_key '';
$mtgox_secret base64_decode ('');
$logfile 'mtgox.log';

$mtgox_error false;
function 
mtgox_error ($m$curl null) {
 global 
$mtgox_error;
 if (
$curl$m .= ': ' curl_error ($curl);
 
$mtgox_error "$m\n";
}
function 
mtgox_log ($result null$amount null) {
 global 
$code$msg$mtgox_error$logfile;
 
$m = array (
  
'time' => time (),
  
'code' => $code,
  
'msg' => $msg,
  
'addr' => $_SERVER ['REMOTE_ADDR'],
 );
 if (isset (
$result)) $m ['result'] = $result;
 if (
is_numeric ($amount)) $m ['amount'] = $amount;
 if (
is_string ($mtgox_error)) $m ['error'] = $mtgox_error;
 
$f fopen ($logfile'at');
 if (
$f) {
  
fwrite ($fserialize ($m) . "\n");
  
fclose ($f);
 }
}
function 
mtgox0 ($method$data = array ()) {
 global 
$mtgox_key$mtgox_secret;
 
$curl curl_init ("https://mtgox.com/api/0/$method.php");
 if (! 
$curl) return mtgox_error ('curl_init () failed');
 if (! 
curl_setopt ($curlCURLOPT_RETURNTRANSFERtrue)) return mtgox_error ('curl_setopt (CURLOPT_RETURNTRANSFER) failed'$curl);
 if (! 
curl_setopt ($curlCURLOPT_USERAGENT'Mozilla/4.0 (compatible; MtGox PHP client; ' php_uname ('s') . '; PHP/' phpversion () . ')')) mtgox_error ('curl_setopt (CURLOPT_USERAGENT) failed'$curl);
 
$r explode (' 'microtime ());
 
$data ['nonce'] = $r [1] . substr ((int) (($r [0] + 1) * 1000000), 1);
 
$r http_build_query ($data);
 if (! 
curl_setopt ($curlCURLOPT_POSTFIELDS$r)) return mtgox_error ('curl_setopt (CURLOPT_POSTFIELDS) failed'$curl);
 if (! 
curl_setopt ($curlCURLOPT_HTTPHEADER, array (
  
"Rest-Key: $mtgox_key",
  
'Rest-Sign: ' base64_encode (hash_hmac ('sha512'$r$mtgox_secrettrue)),
 ))) return 
mtgox_error ('curl_setopt (CURLOPT_HTTPHEADER) failed'$curl);
 
$r curl_exec ($curl);
 if (
curl_errno ($curl)) return mtgox_error ('curl_exec () failed'$curl);
 if (! 
is_string ($r)) return mtgox_error ('CURL did not return data');
 
$d json_decode ($rtrue);
 
$e json_last_error ();
 if (
$e) return mtgox_error ("json_decode () failed: $e; raw data: $r");
 return 
$d;
}
$msg array_key_exists ('msg'$_POST) ? trim ($_POST ['msg']) : '';
$code array_key_exists ('code'$_POST) ? trim ($_POST ['code']) : '';
if (
array_key_exists ('more'$_POST)) $code '';
echo 
'<?xml version="1.0" encoding="UTF-8"?>
';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html version="-//W3C//DTD XHTML 1.1//EN" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/1999/xhtml http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<title>Код Mt.Gox</title>
<style type="text/css">
body {
 background: #67727B;
 font-family: "Lucida Grande", Tahoma, Arial, Verdana, sans-serif;
}
#container {
 width: 35em;
 margin: 20px auto;
 background: black;
 padding-top: 40px;
 box-shadow: 0 0 5px #000;
}
form, textarea, input {
 color: #000;
}
form, textarea, input.text {
 background: #FFF;
}
form {
 padding: 1em 3em 2em;
}
.field {
 margin: 1em 0;
}
textarea, input.text {
 font-family: inherit;
 font-size: inherit;
 width: 28em;
 box-shadow: inset 0 1px 1px #CCC;
 border-bottom: 1px solid #DDD;
 border-left: 1px solid #C3C3C3;
 border-right: 1px solid #C3C3C3;
 border-top: 1px solid #7C7C7C;
 display: block;
 margin-top: .2em;
}
.error {
 color: red;
}
</style>
</head>
<body>
<div id="container">
<form action="<?php echo htmlspecialchars (basename ($_SERVER ['PHP_SELF'])); ?>" method="post">
<?php
if (strlen ($msg) && strlen ($code)) {
 
mtgox_log ();
?>

<input name="msg" type="hidden" value="<?php echo htmlspecialchars ($msgENT_NOQUOTES); ?>" />
<input name="code" type="hidden" value="<?php echo htmlspecialchars ($code); ?>" />
<table>
<tr><td align="right">Сообщение:</td><td align="left"><pre><?php echo htmlspecialchars ($msgENT_NOQUOTES); ?></pre></td></tr>
<tr><td align="right">Код:</td><td align="left"><?php echo htmlspecialchars ($codeENT_NOQUOTES); ?></td></tr>
<?php
 $success 
false;
 
$error '';
 
$r mtgox0 ('redeemCode', array ('code' => $code));
 if (
$r) {
  if (
is_array ($r)) {
   if (
array_key_exists ('amount'$r) && array_key_exists ('currency'$r) && is_numeric ($r ['amount']) && $r ['amount']) {
    
$c $r ['currency'];
    
$amount number_format ($r ['amount'] * $ratio2);
    
mtgox_log ($r$amount);
    
$m =
     
"&#1050; &#1079;&#1072;&#1095;&#1080;&#1089;&#1083;&#1077;&#1085;&#1080;&#1102;: $amount $c\n" .
     
"\n&#1057;&#1086;&#1086;&#1073;&#1097;&#1077;&#1085;&#1080;&#1077;\n$msg\n\n" .
     
"&#1050;&#1086;&#1076;: $code\n" .
     
"\nMt. Gox\n";
    foreach (
$r as $n => $v$m .= "$n$v\n";
    
$m .= "\nIP-&#1072;&#1076;&#1088;&#1077;&#1089;: " $_SERVER ['REMOTE_ADDR'] . "\n";
    
$m str_replace ("\r\n""\n"$m);
    
$m str_replace ("\r""\n"$m);
    
$m str_replace ("\n.""\n.."$m);
    
$m str_replace ("\n""\r\n"$m);
    
$success mail ($mail ['to'], $mail ['subject'], $m"Content-Type: text/plain; charset=UTF-8\r\nFrom: " $mail ['from'], $mail ['parameters']);
    echo 
'<tr><td align="right">&#1062;&#1077;&#1085;&#1072; &#1082;&#1086;&#1076;&#1072;:</td><td align="left">'htmlspecialchars ($r ['amount'] . ' ' $cENT_NOQUOTES), '</td></tr>';
    echo 
'<tr><td align="right">&#1041;&#1091;&#1076;&#1077;&#1090; &#1079;&#1072;&#1095;&#1080;&#1089;&#1083;&#1077;&#1085;&#1086;:</td><td align="left">'htmlspecialchars ($amount ' ' $cENT_NOQUOTES), '</td></tr>';
    if (
array_key_exists ('reference'$r))
     echo 
'<tr><td align="right">&#1050;&#1086;&#1076; &#1086;&#1087;&#1077;&#1088;&#1072;&#1094;&#1080;&#1080;:</td><td align="left">'htmlspecialchars ($r ['reference'], ENT_NOQUOTES), '</td></tr>';
   }
   if (
array_key_exists ('error'$r) && is_string ($r ['error'])) $error '&#1057;&#1086;&#1086;&#1073;&#1097;&#1077;&#1085;&#1080;&#1077; &#1086;&#1090; Mt. Gox: ' $r ['error'];
  } else 
mtgox_log ($r);
 } else 
mtgox_log ();
?>

</table>
<?php
 
if (! $success) echo '<p class="error">' . (strlen ($error) ? htmlspecialchars ($errorENT_NOQUOTES) : '&#1055;&#1088;&#1086;&#1080;&#1079;&#1086;&#1096;&#1083;&#1072; &#1086;&#1096;&#1080;&#1073;&#1082;&#1072;. &#1055;&#1086;&#1078;&#1072;&#1083;&#1091;&#1081;&#1089;&#1090;&#1072;, &#1089;&#1074;&#1103;&#1078;&#1080;&#1090;&#1077;&#1089;&#1100; &#1089;&#1086; &#1089;&#1083;&#1091;&#1078;&#1073;&#1086;&#1081; &#1087;&#1086;&#1076;&#1076;&#1077;&#1088;&#1078;&#1082;&#1080;.') . '</p><input type="submit" value="&#1055;&#1086;&#1087;&#1088;&#1086;&#1073;&#1086;&#1074;&#1072;&#1090;&#1100; &#1077;&#1097;&#1105; &#1088;&#1072;&#1079;" /> ';
 echo 
'<input name="more" type="submit" value="&#1048;&#1089;&#1087;&#1086;&#1083;&#1100;&#1079;&#1086;&#1074;&#1072;&#1090;&#1100; &#1076;&#1088;&#1091;&#1075;&#1086;&#1081; &#1082;&#1086;&#1076;" />';
} else {
?>

<div class="field">
<label>Сообщение<textarea name="msg" cols="33" rows="10"><?php echo htmlspecialchars ($msgENT_NOQUOTES); ?></textarea></label>
<?php if (array_key_exists ('msg'$_POST) && ! strlen ($msg)) echo '<div class="error">&#1053;&#1072;&#1087;&#1080;&#1096;&#1080;&#1090;&#1077; &#1089;&#1086;&#1086;&#1073;&#1097;&#1077;&#1085;&#1080;&#1077;.</div>'?>
</div>
<div class="field">
<label>Код Mt. Gox<input name="code" class="text" value="<?php echo htmlspecialchars ($code); ?>" /></label>
<?php if (array_key_exists ('code'$_POST) && ! strlen ($code) && ! array_key_exists ('more'$_POST)) echo '<div class="error">&#1042;&#1074;&#1077;&#1076;&#1080;&#1090;&#1077; &#1082;&#1086;&#1076;.</div>'?>
</div>
<div><input type="submit" /></div>
<?php
}
?>

</form>
</div>
</body>
</html>
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!