Jump to content

Thomas_L

New Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by Thomas_L

  1. [{"customer":"SWSH","city":"Thomasville","state":"GA","zipcode":"31792","totalUsers":6,"totalActiveUsers":6,"totalInActiveUsers":0,"users":[{"firstName":"xxxx","lastName":"Brooks","phoneNumber":"","userName":"cb_igwrth@xxx.com","createdBy":null,"isActive":true},{"firstName":"Dan","lastName":"Stewart","phoneNumber":"+11111111111","userName":"dan.stxxt@xxxx.ga.gov","createdBy":"kwilliams@xxx.com","isActive":true},{"firstName":"Bill","lastName":"Mott","phoneNumber":"(229) 000-1231","userName":"bill@bxxxr.net","createdBy":null,"isActive":true},{"firstName":"SWSH","lastName":"Test","phoneNumber":"(229) 000-3024","userName":"swsh.test@me.com","createdBy":null,"isActive":true},{"firstName":"Cleaver","lastName":"Brooks","phoneNumber":"","userName":"cb_illngwth@xxxx.com","createdBy":null,"isActive":true},{"firstName":"Fred","lastName":"Baker","phoneNumber":"1111111111","userName":"fred.baker@xxxx.gov","createdBy":null,"isActive":true}]} As requested the Json Format Thanks for all of the help
  2. I truly would like to loop through the user array in the current foreach loop and dump all of the values into the cell for now. After i get that working my end result will be a link that pops up a Bootstrap Modal that contains all of the user array data for each customer.
  3. I have a stdClass Object array with nested User arrays as a value that I would like to display in a table cell. I am struggling and have exhausted a lot of time. I am hoping to get a shove in the right direction if possible. The image below will show what I am trying to do. $someArray = json_decode($token_result); foreach ($someArray as $key => $value) { $combined[] = "<tr><td>" . $value->customer . "</td><td>" . $value->city . '</td> <td>' . $value->state . "</td><td>" . $value->zipcode . '</td> <td>' . $value->totalUsers . "</td><td>" . $value->totalActiveUsers . "</td><td>" . $value->totalInActiveUsers . '</td><td> <a href="">' . $value->users . "</a></td></tr>"; } foreach ($combined as $value) { print $value; } Here is what my Array and Objects look like Array ( [0] => stdClass Object ( [customer] => SWSH [city] => Thomasville [state] => GA [zipcode] => 31792 [totalUsers] => 6 [totalActiveUsers] => 6 [totalInActiveUsers] => 0 [users] => Array ( [0] => stdClass Object ( [firstName] => xxx [lastName] => xxx [phoneNumber] => [userName] => cb_igwrth@xxx.com [createdBy] => [isActive] => 1 ) [1] => stdClass Object ( [firstName] => Dan [lastName] => Stewart [phoneNumber] => +11111111111 [userName] => dan.sxx@xxx.ga.gov [createdBy] => kwilliams@xxx.com [isActive] => 1 ) ) ) [1] => stdClass Object ( [customer] => xxxx [city] => Carver [state] => MA [zipcode] => 02330 [totalUsers] => 3 [totalActiveUsers] => 3 [totalInActiveUsers] => 0 [users] => Array ( [0] => stdClass Object ( [firstName] => Leo [lastName] => Furtado [phoneNumber] => 781-000-0000 [userName] => LFurtado@xxx.com [createdBy] => TConger@ccccc.com [isActive] => 1 ) ) ) ) Table is attached
  4. Thanks @NotionCommotion Ill have to get with our dev team that manages the backend to the APIs for further server side testing. Was hoping to find the easy i'm over looking.
  5. @Barand I am not doing both. This was just to show you all what I did as well in AJAX. My cURL code is posted first the ajax 2nd.
  6. I have a working API that I can get a json web token from in curl on my server, jquery ajax, postman, anything id like but php cURL.. I need help. I'm sure I'm over looking something easy. $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'http://xxxxx/xxxxx/xxxx/auth/login', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS =>'{ "checked":"", "username":"xxxxxxxx", "password":"xxxxxxxx" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; Here is my Ajax code that works: <script> var settings = { "url": "xxxxxxx/xxxxxxx/xxxxxxxxx", "crossDomain": "true", "method": "POST", "timeout": 0, "headers": { "Content-Type": "application/json" }, "data": JSON.stringify({ "checked": "", "username": "xxxxxxxx", "password": "xxxxxxxx" }), }; $.ajax(settings).done(function (response) { console.log(response); }); </script> Im lost. I have checked that cURL is enabled on my server. I have tested pulling webpages with cURL with out post data just fine.
  7. Barand You are the Best! I know sometimes I run in to an end and the solution is there but just hard to find after staring at the same code for days, you my friend are a great start to my weekend! Best to you. And just so you know I posted this on Stack Overflow and was told that I did not try enough and i should try harder before asking questions. I will speak highly of this form and stick around to see if I can help others as well.
  8. I have an array that looks like this: array(5642) { [0]=> string(19) "2021-02-10 09:04:48" [1]=> string(19) "2021-02-10 09:04:54" [2]=> string(19) "2021-02-10 09:05:00" [3]=> string(19) "2021-02-10 09:05:06" [4]=> string(19) "2021-02-10 09:05:12" [5]=> string(19) "2021-02-10 09:05:18" [6]=> string(19) "2021-02-10 09:06:18" [7]=> string(19) "2021-02-10 09:06:24" } I need to group the instances any time there is more than a 6 second gap between elements. So 0 =>5 would be one array and 6 and 7 would be a new array. Ive been able to produce the following but its not ideal array(5642) { [0]=> string(19) "2021-02-10 09:04:48" [1]=> string(19) "2021-02-10 09:04:54" [2]=> string(19) "2021-02-10 09:05:00" [3]=> string(19) "2021-02-10 09:05:06" [4]=> string(19) "2021-02-10 09:05:12" [5]=> string(19) "2021-02-10 09:05:18" [6]=> string(19) "end" [7]=> string(19) "2021-02-10 09:06:18" [8]=> string(19) "2021-02-10 09:06:24" } $burner_time = array(); foreach($Burner_Control_Alm as $new_burner){ $burner_time[] = strtotime($new_burner); } $repl = 'end'; for ($i=1; $i<count($burner_time); $i++) { $value_second = $burner_time[$i]; $value_first = $burner_time[$i-1] === $repl ? $burner_time[$i-2] : $burner_time[$i-1]; if ($value_second > $value_first + 6) { array_splice($burner_time, $i++, 0, $repl); } print_r($burner_time); }
×
×
  • 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.