1

i am trying to call a php Api through API using asp.net c#, could anyone please help me i want to call the following API username: admin password: ****

http://Ip Hidden/WHMCS_1/includes/api.php

enter image description here check the following code it throw error thanks in advance

3
  • is it a restful API and what content-type does it support? Commented Aug 13, 2015 at 11:13
  • You would at least need to provide more information about the remote API in question: if it's SOAP, then the WSDL would help. Or maybe it's REST, or maybe it's a custom protocol, etc. Commented Aug 13, 2015 at 11:16
  • i have add some code kindly check why its throw error Commented Aug 13, 2015 at 11:23

1 Answer 1

1

This is a pretty broad question so this answer is broad too.

You can use the WebClient class for this:

Provides common methods for sending data to and receiving data from a resource identified by a URI

WebClient Class - MSDN docs with example usage

In later versions of .net you can use:

HttpClient class - MSDN docs with example usage

Sign up to request clarification or add additional context in comments.

2 Comments

i have mention code above but its throw an error , i don't know whats the problem is ?
@RazimKhan A 403 error is the server denying access. Do you have any documentation for the API? If so you really need to check what a valid http request looks like, check that your sent request matches via a tool like fiddler. Also double check credentials & hashing process is as expected. Failing that contact API vendor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.