What is an API?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • henryrhenryr
    New Member
    • Jun 2007
    • 103

    What is an API?

    Appologies if PHP is the wrong place for this. There is no API section and I only really know PHP.

    I have built my own shopping cart for my website using PHP 4.3. I am looking at payment processing and I will probably use Paypal Website Payments Pro (UK Version).

    My Questions... (sorry if they have obvious answers!)
    - what is an API?
    - if I know PHP and XHTML pretty well do I need any other programming skills?
    - is an API something you download and install or just a syntax (like HTML?)

    Thanks in advance!
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    API is short for Application Programming Interface (Click for wikipedia link)

    PHP is an API used for server-side web programming, as are ASP and JSP.
    Direct3D and OpenGL are graphics API's and the functions used by windows programmers to create windows and controls is called WinAPI.

    It is not really a program or some programming tool, it is the programming language itself.

    Comment

    • henryrhenryr
      New Member
      • Jun 2007
      • 103

      #3
      Ahh.. Thanks! That makes it clear. And so really, in order to programme using an API, I only really need to know the syntax and I can at least give it a go?

      Comment

      • NoComment
        New Member
        • Jun 2007
        • 16

        #4
        Originally posted by Atli
        It is not really a program or some programming tool, it is the programming language itself.
        Sorry about that, but this is not correct. :P

        An API is not a programming language, but (like the name says) an interface. Interfaces and programming languages are two different things:

        A programming language is a way to represent algorithms, logic and commands in a human-readable form. Some would even say, PHP is not a programming, but a script language, since it is interpreted, while source code written in "real" programming languages as C or C++ is first compiled, linked (which results in an .exe file) and THEN executed. I have written programs myself in C++ for several years now, and PHP and C/C++ are very similar in their syntax, although C/C++ syntax is MUCH more strict. In C/C++, for example, you have to define the exact data type a variable has--not like in PHP where this can change all the time.

        An API, however, is an interface that is developed for a programming language, so that source code written in that language can use the API to do certain tasks (like rendering graphics when it comes to DirectX or displaying windows or writing/reading files when it comes to the WindowsAPI).

        So, an API is not the programming language itself, but the interface which can be used by source code to access certain functions. This may sound like it's the same (and in PHP you sometimes think it is), but it's actually not.

        In C/C++ you may perfectly well code a program which does not use any API and just does some math or reorganizes the RAM, although this is pretty useless since when you don't use an API, there is no way to interact with the outside world, like actually printing out your results or taking in user information.

        Hope this somehow helps?

        :)

        Comment

        Working...