bendrop Posted July 24, 2020 Share Posted July 24, 2020 If you want to use a currency not supported by WHMCS (I think there are only 8 or so) then you can use this hook, which draws its data from https://www.currencyconverterapi.com/. They have a free account which is sufficient for a once a day cron update, although of course you can upgrade if need be. Firstly you need to sign up with ccapi to get your free API key, then edit the variables at the top of the hook file to suit your needs. Finally, place the file in the /includes/hooks directory and you're done 🙂 hook_cron_update_custom_currency.php 1 Quote Link to comment Share on other sites More sharing options...
Mohsin Amer Posted August 2, 2020 Share Posted August 2, 2020 I need help, I'm using USD as default currency and want to convert to PKR, I input all the required parameters correct still it says failed in the Activity Log. I have tried running the API through browser and it works fine and gives result but WHMCS is not working with it, help please. 0 Quote Link to comment Share on other sites More sharing options...
bendrop Posted August 3, 2020 Author Share Posted August 3, 2020 Have you run it from a browser / wget on the server? The free api key only lets you connect from a single ip address. 0 Quote Link to comment Share on other sites More sharing options...
Mohsin Amer Posted August 3, 2020 Share Posted August 3, 2020 3 hours ago, bendrop said: Have you run it from a browser / wget on the server? The free api key only lets you connect from a single ip address. At first when I registered the API, I copied the key from the email I received and pasted it directly in the config and waited till the next day for the CRON job to trigger and update it, it said failed, then I tried it in my browser from my personal laptop and it returned the results fine. What I'm trying to say is that I did not use the API ANYWHERE else before putting it in the config and letting the CRON run. For information, we use CloudFlare to proxy our company domains and WHMCS installation, and cURL is fully setup and running without any issues. 0 Quote Link to comment Share on other sites More sharing options...
bendrop Posted August 10, 2020 Author Share Posted August 10, 2020 That "failed" message will trigger if the script couldn't connect to the api server, that's all it does. This is why you need to try and run the api call directly from the server to see if it's giving some kind of denied error. 0 Quote Link to comment Share on other sites More sharing options...
Mohsin Amer Posted August 19, 2020 Share Posted August 19, 2020 On 8/11/2020 at 2:47 AM, bendrop said: That "failed" message will trigger if the script couldn't connect to the api server, that's all it does. This is why you need to try and run the api call directly from the server to see if it's giving some kind of denied error. Can you tell me the format of the command to run at server side? As I run wget or curl I get this: Quote https://free.currconv.com/api/v7/convert?q=USD_PKR Resolving free.currconv.com (free.currconv.com)... 104.18.48.56, 104.18.49.56, 172.67.140.185, ... Connecting to free.currconv.com (free.currconv.com)|104.18.48.56|:443... connected. HTTP request sent, awaiting response... 400 Bad request 2020-08-19 02:58:09 ERROR 400: Bad request. [1]- Exit 8 wget https://free.currconv.com/api/v7/convert?q=USD_PKR [2]+ Done compact=ultra Awaiting your response. 0 Quote Link to comment Share on other sites More sharing options...
bendrop Posted August 19, 2020 Author Share Posted August 19, 2020 Sure! https://free.currconv.com/api/v7/convert?q=USD_PKR&compact=ultra&apiKey=YOURAPIKEY Obviously changing "YOURAPIKEY" to your api key 🙂 0 Quote Link to comment Share on other sites More sharing options...
Mohsin Amer Posted August 19, 2020 Share Posted August 19, 2020 4 hours ago, bendrop said: Sure! https://free.currconv.com/api/v7/convert?q=USD_PKR&compact=ultra&apiKey=YOURAPIKEY Obviously changing "YOURAPIKEY" to your api key 🙂 This is what I run: Quote wget https://free.currconv.com/api/v7/convert?q=USD_PKR&compact=ultra&apiKey=YOURAPIKEY Yes I do fill in the required text but it does not return a response and asks me to provide a API KEY whilst I have already provided. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 19, 2020 Share Posted August 19, 2020 1 hour ago, Mohsin Amer said: Yes I do fill in the required text but it does not return a response and asks me to provide a API KEY whilst I have already provided. did you get your own API key from their site ? https://free.currencyconverterapi.com/free-api-key you will need a unique key and can't just use the phrase "YOURAPIKEY" in the link. 🙂 0 Quote Link to comment Share on other sites More sharing options...
Mohsin Amer Posted August 19, 2020 Share Posted August 19, 2020 1 minute ago, brian! said: did you get your own API key from their site ? https://free.currencyconverterapi.com/free-api-key you will need a unique key and can't just use the phrase "YOURAPIKEY" in the link. 🙂 Yes I do have an API key, just using "YOURAPIKEY" as a reference. 0 Quote Link to comment Share on other sites More sharing options...
bendrop Posted August 19, 2020 Author Share Posted August 19, 2020 2 hours ago, Mohsin Amer said: This is what I run: Yes I do fill in the required text but it does not return a response and asks me to provide a API KEY whilst I have already provided. But it works from your own personal computer right? This points towards a block then, as you can only do the check from a single IP. Email them and and ask for the IP to be reset. 0 Quote Link to comment Share on other sites More sharing options...
sorabit Posted August 23, 2020 Share Posted August 23, 2020 You must verify email first 0 Quote Link to comment Share on other sites More sharing options...
Mohsin Amer Posted August 24, 2020 Share Posted August 24, 2020 22 hours ago, sorabit said: You must verify email first Let me clarify things, I have verified the email, I have reset the IP, I have cURL installed, the thing is it is working occasionally, like it works one day and next day it doesn't and so on, I guess it has to do with it being free. Thanks for your help and guiding through. 0 Quote Link to comment Share on other sites More sharing options...
bendrop Posted August 24, 2020 Author Share Posted August 24, 2020 It could be.. You can get a pay as you go account from them which equates to $1.50 a month. Depends how important daily updates are to you! 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.