Harish Batchu

Harish Batchu

  • NA
  • 255
  • 71k

I need information regarding to get the live currency of di?

Oct 9 2018 8:52 PM
1. I have on requirement to display live currency data and sencex data in my web application is their any free api to get the information.
 
2. I need to send otp to user i have two types of sanple code but it's does not working can give me the solution. i will share the code.
 
Thanks in advance
 
#1
  1. Public string APICall(strig url)  
  2. {  
  3. WebClient client = new WebClient();  
  4. Stream s = client.OpenRead(string.Format(url));  
  5. StreamReader reader = new StreamReader(s);  
  6. string result = reader.ReadToEnd();  
  7. return result;  
  8.   
  9. }  
  10. [HttpPost]  
  11. public string GetSecuredData(string userName)  
  12. {  
  13. string url = "Here I am passing the url";  
  14. string securedInfo = "";  
  15. string js = Apicall(url);  
  16. if (js != "0")  
  17. securedInfo = "OTP Send Success";  
  18. else  
  19. securedInfo = "please try again.";  
  20. return securedInfo;  
  21. }  
#2 Model
  1. public String Apicall(string url)  
  2. {  
  3. HttpWebRequest httpreq = (HttpWebRequest)WebRequest.Create(url);  
  4. try  
  5. {  
  6. HttpWebResponse httpres = (HttpWebResponse)httpreq.GetResponse();  
  7. StreamReader sr = new StreamReader(httpres.GetResponseStream());  
  8. string results = sr.ReadToEnd();  
  9. sr.Close();  
  10. return results;//}  
  11. catch  
  12. {  
  13. return "0";  
  14. }  
  15. [HttpPost]  
  16. public string GetSecuredData(string userName)  
  17. {  
  18. string url = "Passing url"  
  19. string js = Apicall(url);  
  20. if (js != "0")  
  21. securedInfo = "OTP Send Success";  
  22. else  
  23. securedInfo = "please try again.";  
  24. return securedInfo;  
  25. }  

Answers (3)