Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Wyciąganie danych JSON przez PHP
xaitras
post
Post #1





Grupa: Zarejestrowani
Postów: 31
Pomógł: 0
Dołączył: 27.06.2017

Ostrzeżenie: (0%)
-----


Witam wszystkich forumowiczów

Borykam się z problemem od dłuższego czasu. Może ktoś pomoże..

Do tej pory wykombinowałem takie coś:

  1.  
  2. $params = array (
  3.  
  4. 'token' => 'xxx-xxx-xxxx-xxxx',
  5. 'method' => 'getOrders',
  6. 'parameters' => '{ "status_id": 36310}'
  7.  
  8. );
  9.  
  10. $query = http_build_query ($params);
  11.  
  12. $contextData = array (
  13. 'method' => 'POST',
  14. 'header' => "Connection: close\r\n" .
  15. "Content-Length: ".strlen($query)."\r\n",
  16. 'content'=> $query );
  17.  
  18.  
  19. $context = stream_context_create (array ( 'http' => $contextData ));
  20.  
  21. $result = file_get_contents ('https://api.baselinker.com/connector.php', false, $context);
  22.  
  23.  
  24. $dane = json_decode($result);
  25.  
  26. $w = var_dump($dane);
  27.  
  28. echo $w;
  29.  


Próbuję wyciągnąć wszystkie numery zamówień z danego statusu ( api baselinker )
Problem w tym, że nie wiem jak wyciągnąć tylko numery.. (IMG:style_emoticons/default/facepalmxd.gif) (IMG:style_emoticons/default/sad.gif)
Wyświetla mi wszystkie dane zamówienia.



Pozdrawiam i czekam na pomoc (IMG:style_emoticons/default/sciana.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
xaitras
post
Post #2





Grupa: Zarejestrowani
Postów: 31
Pomógł: 0
Dołączył: 27.06.2017

Ostrzeżenie: (0%)
-----


No właśnie nie wywala błędu tylko ostrzeżenie :

  1.  
  2. Warning: array_walk() expects parameter 1 to be array, string given in C:\WebServ\httpd\test.php on line 33
  3. {"status":"SUCCESS","orders":[{"order_id":17345415,"external_order_id":"725101700","order_source":"allegro","order_source_id":"6136","order_source_info":"-","order_status_id":36310,"confirmed":true,"date_confirmed":"1498387418","date_add":1498387147,"user_login":"kamii188","phone":"723756482","email":"kamii3@buziaczek.pl","user_comments":"","admin_comments":"","currency":"PLN","payment_method":"Przelew bankowy","payment_method_cod":"0","payment_done":0,"delivery_method":"Pocztex Kurier48","delivery_price":15,"delivery_package_module":"","delivery_package_nr":"","delivery_fullname":"Kamila Iwaszko","delivery_company":"","delivery_address":"Trzebicz Nowy 1","delivery_city":"Drezdenko","delivery_postcode":"66-530","delivery_country":"Polska","delivery_country_code":"PL","delivery_point_name":"","delivery_point_address":"","delivery_point_postcode":"","delivery_point_city":"","invoice_fullname":"Kamila Iwaszko","invoice_company":"","invoice_nip":"","invoice_address":"Trzebicz Nowy 1","invoice_city":"Drezdenko","invoice_postcode":"66-
  4.  


Może ktoś się zlituje i naprowadzi mnie jak wyciąnąć tylko numery "order_id" (IMG:style_emoticons/default/questionmark.gif)
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 14.10.2025 - 16:26