Thread: PHP - XML - "API"?
-
August 23rd, 2010, 02:09 PM #1Member
- Join Date
- Mar 2005
- Posts
- 93
PHP - XML - "API"?
Hello TechIMO users,
I need to test the communication between several workstations using a browser, with what I call right now an "API".
Here's what I've done so far:
USING PHP
1) Upload a picture form. Write a name for the picture
2) When user uploads the picture, the app renames the file to the one given by the user, and then generates an XML with the name of the file, the ip of the workstation, and the image itself in base64.
3) The XML is saved on a /xml folder with "name.xml"
4) The image is saved on a /image folder with "name.xxx" (xxx = jpg, gif...etc)
The PHP shows (after submission):
- XML content
- name an folders where the files were saved.
SO... Now the "API" comes to work, and this is where I am stuck...
5) The PHP app should alert the "API" to pick up the /xml/name.xml .
6) The "API" should read the alert, and pick up the file.
7) The "API" will check the xml, if it is "understandable" and then return a "Flag" to the PHP app
8) The PHP app should display in the screen, the response of the "flag" after showing the XML content.
So, my questions are:
a) Should I use PHP as the "API"? I tried with http-request but I noticed it is now disabled in PHP 5.3.1
b) What other programming language do you suggest?
c) If this is not an "API" how would you call it?
Keep in mind that the "API" receives an xml, and returns a positive or negative answer, but doesn't interact directly with the user.
Thank you all for your valuable help!!!
-
September 14th, 2010, 01:35 AM #2
Sometimes simpler is better, How about this.
Do a check ifexists using php, if it does exist then display xml content, if content is true then task completed and display or whatever want to do with it from there.
$filename = "wherever get unique filename from or the variable for it";
$xml_filename = "./xml/$filename.xml";
if (file_exists($xml_filename)) {
$xml_exists = $xml_filename;
} else {
$xml_exists = "some alternate message or file location";
}
Just some fast code, should do what you need, you can add even more ifexists or even set temporary expected file locations as variables prior to checking, and check those as well.Last edited by quickoldcar; September 14th, 2010 at 01:56 AM.
DynaIndex.com - Dynamic search index of websites, links, feeds, title, description, keywords and thumbnail snapshot.
-
September 14th, 2010, 01:43 AM #3
You can use curl in php to check for that file across servers, forgot to mention that.
Curl seems the most flexible and reliable to me.DynaIndex.com - Dynamic search index of websites, links, feeds, title, description, keywords and thumbnail snapshot.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
T'isnt a "massage"! Its "the religious act of "laying on of hands"
By no1_vern in forum DebateIMO: Politics, Religion, ControversyReplies: 3Last Post: September 29th, 2008, 08:29 PM -
[PHP] Creating "if" Statement for Email Form
By Cody in forum Webmastering and ProgrammingReplies: 2Last Post: August 8th, 2006, 06:28 PM -
How do I disable the "power", "sleep", and "wake" buttons.
By ShawnD1 in forum General Tech DiscussionReplies: 1Last Post: January 30th, 2004, 11:50 AM -
Remember the "Worm", "Cave", or "Ribbon" games?
By SickPup404 in forum IMO CommunityReplies: 11Last Post: July 10th, 2002, 07:02 PM



LinkBack URL
About LinkBacks



Reply With Quote

Favorite YouTube, Google Video,...