| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
Registered User
|
PHP and API
i'm fairly new to PHP and API but I was wondering how do I grab the data from the XML script, that was generated by the API? I have this project where I have an API that generates an XML script and I'm supposed to grab that data from the XML script and insert the data as a record in a database using mysql. please help? so confused. |
|
|
|
|
|
#2 (permalink) |
|
Grumpy old man
Join Date: Oct 2007
Location: North Japan
Posts: 1,373
|
First, I think it would help you to get a really solid understanding of the terms you're using. PHP is a programming language, which I assume you know. *An* API is a published interface provided to allow you to directly communicate with someone else's software system without needing to know the internals of how it works. Generally in web terms they're used to suck data from another source, but this is only one of the many definitions depending on the context. The 'an' is significant because no two APIs are the same. There isn't a set way to use one. XML is a data definition language that has no purpose other than to describe raw data. It isn't a script in the generally accepted use of the term. Given that you're "fairly new" to PHP, this is likely to be a challenging project for you at this stage. The task you are describing involves a number of steps, none of which are really at the beginner level. Actually most web-based API programming (e.g. Yahoo API, Google's APIs) tends to be done in Javascript using AJAX (or JSON as a substitute for XML). The only time I used PHP with a third-party API, I used PHP Curl, and found it extremely flexible and straightforward. The manual page is here: PHP: CURL - Manual - this might be a starting point for you. |
|
|
|
#3 (permalink) |
|
shiro
Join Date: Aug 2007
Location: Yokohama, Japan
Posts: 1,657
|
It is possible to parse XML with PHP, but I've never done it myself so I can't really give any advise on it. But here is the manual that can tell you what to do: PHP:XML - Manual |
|
![]() |