Jump to content

mgunnels

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Everything posted by mgunnels

  1. First thanks for any help that you can provide. I am somewhat new to PHP and this is the first "Web Service" I have had to create. THE GOAL: I need to pull XML data from another server. This company's API is setup so that you must give an IP and so you can only pull data from server to server instead of client to server. The data is pulled from the API using HTTP requests...very similar to YQL. (in essence the structured query is located in the URL). This API also requires that my server only ping's their server every 10-15 mins, in order to cut down on server requests. The logical thought in my head was to setup: a cron job to run a PHP script every 10 mins. The PHP scripts would then do the following: 1. Make the HTTP request 2. Open an existing file or create one (on my server) 3. Take the returned XML data from the API and write to the newly opened file. 4. Convert that XML to JSON. 5. Save the JSON 6. Cache the JSON file 7. STOP My thought was to use curl and fopen for the first 3 steps. I found a basic script that will do this on PHP.net (as shown below). After that I am pretty much lost on how to proceed. <?php $ch = curl_init("http://www.example.com/"); $fp = fopen("example_homepage.txt", "w"); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); fclose($fp); ?> I would REALLY appreciate any help on this. Also, if you have the time to please comment and explain what you are doing in any code examples and why....that would HELP out a lot. I truly want to learn not just grab a snippet and run. So, your comments are vital for me. thank!!!
  2. I think the main issue I had with this is that...each subtask that is dynamically created must relate back to its task. I may be way off base...but the names look some thing like: task_1 subtask1:1 subtask1:2 (where 1= the task number and 2 tells me this is the 2nd subtask for task 1)
  3. Let me try again. 1. A knowledge of Jquery serialize(); is needed. This creates a JSON string that would need to be decoded after the user posts the form. ---The form uses Jquery to dynamically create/name the input fields. An example of the form is here: http://jsfiddle.net/mgunnels/WNUEJ/38/ Each task can have multiple subtasks. Instead of trying to put an huge code bock in this forum all the code is found at the above URL. It should explain how everything is done. 2. I need to get help on how to create the decode of the JSON string and then insert that data into the DB. 3. The next issue is the DB table. I am lost on how I should format/create this table(s) to handle dynamically created fields. And also..how to associate the tasks/subtasks. ***Imagine that a user can create multiple tasks and each tasks can have multiple subtasks. Each tasks/subtask relationship should be unique. Check out the code for a better idea. Sorry.
  4. No not really. I can use JQuery serialize(); to handle the post. The post is not the issue. The issue is what to do after that.
  5. Alright, I give up! ----I need help! Here is what I am doing. I am creating a way for a user to create dynamic tasks/subtasks using Jquery. My problem is really 3 fold. 1. (the easy part)...I am going to use Jquery Serialize() to submit the form to my PHP script. 2. (now we are getting warmed up)...I am lost on how to read the dynamically created fields...in PHP. The Jquery script will create a unique name for each field that is dynamically created. 3. (even harder)...MySQL (a)---I need to figure out an appropriate table format so that the tasks are associated with the subtasks. I tried to incorporate this in the names that are generated through jquery, but in SQL is where the real magic will need to happen in order to tie the subtasks to the corresponding task. (b)----How do I create the insert statement? Here is the code thus far: http://jsfiddle.net/mgunnels/WNUEJ/38/ Please help....I know this is a lot to ask, but I am truly lost.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.