
Change API PHP file
- or -
Post a project like this2594
$
- Posted:
- Proposals: 2
- Remote
- #1910836
- Awarded
Description
Experience Level: Entry
Change the place the php code gets data from
Change it to get get exchange rate from https://api.cryptonator.com/api
php code
function get_google_exchange( $orginal_price, $other_price ) {
$url = 'https://finance.google.com/finance/converter';
$rates = array();
if ( $other_price ) {
$other_price = array_filter( explode( ',', $other_price ) );
}
foreach ( $other_price as $code ) {
$request = wp_remote_get(
$url, array(
'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36',
'timeout' => 10,
'body' => array(
'from' => $orginal_price,
'to' => $code,
'a' => 1
)
)
);
if ( ! is_wp_error( $request ) || wp_remote_retrieve_response_code( $request ) === 200 ) {
$content = $request['body'];
preg_match( '//i', $content, $result );
if ( count( array_filter( $result ) ) == 3 || count( array_filter( $result ) ) == 2 ) {
$rates[$code] = $result[1];
}
}
}
$rates = array_filter( $rates );
return $rates;
}
Change it to get get exchange rate from https://api.cryptonator.com/api
php code
function get_google_exchange( $orginal_price, $other_price ) {
$url = 'https://finance.google.com/finance/converter';
$rates = array();
if ( $other_price ) {
$other_price = array_filter( explode( ',', $other_price ) );
}
foreach ( $other_price as $code ) {
$request = wp_remote_get(
$url, array(
'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36',
'timeout' => 10,
'body' => array(
'from' => $orginal_price,
'to' => $code,
'a' => 1
)
)
);
if ( ! is_wp_error( $request ) || wp_remote_retrieve_response_code( $request ) === 200 ) {
$content = $request['body'];
preg_match( '//i', $content, $result );
if ( count( array_filter( $result ) ) == 3 || count( array_filter( $result ) ) == 2 ) {
$rates[$code] = $result[1];
}
}
}
$rates = array_filter( $rates );
return $rates;
}

Matthew M.
100% (4)Projects Completed
2
Freelancers worked with
2
Projects awarded
100%
Last project
21 Apr 2018
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies