Jump to content

Svarog

Members
  • Posts

    13
  • Joined

  • Last visited

Recent Profile Visitors

977 profile views

Svarog's Achievements

Newbie

Newbie (1/5)

1

Reputation

  1. Hi @Svarog 
    Greetings!

    Reference to your post regarding professional expert needed for finish up the Membership website

    I have 10+ years into development using PHP based frameworks, and previously had been working with companies as full time employee. 

    Have been working on freelance projects from client across Europe, US and UK regions.


    Let me know your suitable timings for scheduling online meet


    Awaiting your response 

    Best Regards
    Deep 

     

  2. Looking for an affordable US-based PHP programmer to help finish a Membership Website: Expertise needed in: PHP, WordPress, Memberships, Ultimate Membership Pro Plugin (important) It's a smaller-sized project - the website is built, only needs Member Registration and Forms sequence built and straightened out. It's quite urgent, so attending to the project is important. Email to developer @ thedigitalmotion dot com
      • 1
      • Like
  3. I am sorry - all my fault..... but I just want to say - this was a misunderstanding of big proportions, and I apologize...
  4. I did not mean to upset you so much, I've explained in my Post 1 what I wanted to accomplish... sorry it turned so not nice...
  5. - thank you for your help. - I just wanted those 4 values to appear in the table 'Description' 'Status' 'Timestamp' 'Datasheet', not the whole list...
  6. $url = 'http://api.macomtech.smrtsrc.com/1.0/parts/parts?categoryGroupID=1'; sorry, I do not know what else can I show you...
  7. I changed $data = json_decode($result, true); to $data = json_decode($result, true); echo "<pre>"; print_r($data); exit(); that output brought a full-blown JSON list (the whole page)
  8. Here is what is left after your hardcoded example was removed - it has an actual url: <?php $url = 'http://api.macomtech.smrtsrc.com/1.0/parts/parts?categoryGroupID=1'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, ['X-Auth-Token: Example']); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $result = curl_exec($ch); if (!$result) { echo 'Curl error: ' . curl_error($ch); die(); } $data = json_decode($result, true); $header = array(); foreach ($data as $jsons) $header = array_values(array_unique(array_merge($header,array_keys($jsons)))); echo '<table border="1">'; echo '<tr><th>'.implode('</th><th>',$header).'</th></tr>'; foreach ($data as $jsons) { echo '<tr>'; $row = array(); foreach ($header as $h) $row[$h] = (isset($jsons[$h])) ? $jsons[$h] : ''; echo '<td>'.implode('</td><td>',$row).'</td>'; echo '</tr>'; } echo '</table>'; ?> now after saving - the table stopped working and there's these warnings: Warning: Invalid argument supplied for foreach() in eval() (line 19 of C:\xampp\apps\drupal\htdocs\modules\php\php.module(80) : eval()'d code). Warning: Invalid argument supplied for foreach() in eval() (line 24 of C:\xampp\apps\drupal\htdocs\modules\php\php.module(80) : eval()'d code). Warning: Invalid argument supplied for foreach() in eval() (line 19 of C:\xampp\apps\drupal\htdocs\modules\php\php.module(80) : eval()'d code). Warning: Invalid argument supplied for foreach() in eval() (line 24 of C:\xampp\apps\drupal\htdocs\modules\php\php.module(80) : eval()'d code).
  9. Hi - I appreciate your help on this greatly! I think, with your help - we are almost there!! Removing your hardcoded example.... can you stay with me for a few til it's working? thanks~! removed $result = <<<EOR [ {"PartID":456,"Category":3,"Status":"another status","Timestamp":"99999"}, {"PartID":123,"Category":5,"PartNumber":1267,"Description":"blabla....","Status":"some status","Timestamp":"123456789","Datasheet":"some value"}, {"PartID":456,"Category":2,"Description":"some description","Timestamp":"99999"} ] EOR;
  10. OK - the table was generated with your code - my appreciation! no errors, or anything... but - there is the whole list of raw JSON from the API that is displayed above the table... I wanted to see if this could be added/changed: 1. this JSON to not appear there but rather be used as the source for variables that we need to get; 2. the table to have those "Part Number", etc. areas to be generated from the JSON list, and not hardcoded.... (like appear inbetween EOR thingies to be inserted into the table, but not handcoded in like in the example that works now, but from the JSON list) Here is what I have now (minus the actual URL) and it works - a generated table below a bunch of raw JSON: <?php $url = 'http://api.domain.com/1.0/parts/parts?categoryGroupID=1'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, ['X-Auth-Token: Example']); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $result = curl_exec($ch); if (!$result) { echo 'Curl error: ' . curl_error($ch); die(); } $result = <<<EOR [ {"PartID":456,"Category":3,"Status":"another status","Timestamp":"99999"}, {"PartID":123,"Category":5,"PartNumber":1267,"Description":"blabla....","Status":"some status","Timestamp":"123456789","Datasheet":"some value"}, {"PartID":456,"Category":2,"Description":"some description","Timestamp":"99999"} ] EOR; $data = json_decode($result, true); $header = array(); foreach ($data as $jsons) $header = array_values(array_unique(array_merge($header,array_keys($jsons)))); echo '<table border="1">'; echo '<tr><th>'.implode('</th><th>',$header).'</th></tr>'; foreach ($data as $jsons) { echo '<tr>'; $row = array(); foreach ($header as $h) $row[$h] = (isset($jsons[$h])) ? $jsons[$h] : ''; echo '<td>'.implode('</td><td>',$row).'</td>'; echo '</tr>'; } echo '</table>'; ?>
  11. My apologies - what does EOR represent here?
  12. I appreciate your input! OK, I understand that part: "$result = '[{"PartID":123,"Category":5,"PartNumber":1267,"Description":"blabla....","Status":"some status","Timestamp":"123456789","Datasheet":"some value"}]';" - but this is hardcoding the result in, isn't it? how do we make, for instance "PartID" values, to be taken from JSON return list, not hardcoded but dynamicaly generating those values in the table?
  13. Thank you for your reply! The API returned and displayed on the page raw JSON in the format: [{"PartID":###,"Category":5,"PartNumber":1267,"Description":blabla.... }] - so, I just need not to display this whole list but display 4 items like "PartNumber", "Description" in the table that will generate these items out of the whole list. The list of course repeats these items over and over.
  14. I am looking for an example, or a link to a working example of this arrangement: You place RESTful call for certain values to a URL which is a JSON list, generated by an API, then - return those JSON values and display in a generated table. I hope that I have explained this well enough - the example below explains it better. So far, I came up with this: <?php $url = 'http://domain.com/1.0/parts/parts?categoryGroupID=1'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, ['X-Auth-Token: Example']); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $result = curl_exec($ch); if (!$result) { echo 'Curl error: ' . curl_error($ch); die(); } $data = json_decode($result, true); curl_close($ch); echo '<table>'; echo '<tr><th>Part Number</th><th>Description</th><th>Status</th><th>Timestamp</th><th>Datasheet</th></tr>'; $n = 0; foreach ($data as $key => $jsons) { foreach ($jsons as $key => $value) { echo '<tr>'; echo '<td>' . $data[$n]['PartNumber'] . '</td>'; echo '<td>' . $data[$n]['Description'] . '</td>'; echo '<td>' . $data[$n]['Status'] . '</td>'; echo '<td>' . $data[$n]['Timestamp'] . '</td>'; echo '<td>' . $data[$n]['Datasheet'] . '</td>'; echo '</tr>'; $n++; } } echo '</table>'; It pretty much describes what I want to do. At this point, the script brings back raw JSON from the URL and displays it on the page, and then creates an empty table below raw JSON. It also produces this warning: "Warning: Invalid argument supplied for foreach() in eval()... "... - it is obvious, that the engine to choose items for display in the table is missing - it would be nice to get specific values into the appropriate <td>s and this script does not have theengine to do it yet... maybe you could suggest this addition of that code? Thank you for looking at this Post and I appreciate your help in pointing me in the right direction!
×
×
  • 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.