php - Trying to link external API with Wordpress
Get the solution ↓↓↓I have an external API with authorisation but anytime i attempt to insert the API data into database i get this error
Attempt to read property "brand_id" on bool
Here is how my API is showing after saved in the database
object(stdClass)#7715 (2) { ["success"]=> bool(true) ["brands"]=> array(720) { [0]=> object(stdClass)#7714 (11) { ["id"]=> int(384) ["brand_id"]=> string(1) "0" ["brand_name"]=> string(6) "A-Plus" ["show"]=> int(1) ["slug"]=> string(6) "a-plus" ["brand_logo"]=> string(45) "mAnCsUKkSnv69aJsDvYLvWfGhKFORvRGn4v5CVAk.jpeg" ["total_products"]=> int(4) ["brand_alias_id"]=> NULL ["brand_alias"]=> NULL ["brand_description"]=> string(0) "" ["brand_country"]=> string(12) "5YtAet18jjZz" } [1]=> object(stdClass)#7713 (11) { ["id"]=> int(369) ["brand_id"]=> string(2) "94" ["brand_name"]=> string(4) "
Before saved in the database
array(6) { ["headers"]=> object(Requests_Utility_CaseInsensitiveDictionary)#7733 (1) { ["data":protected]=> array(19) { ["server"]=> string(5) "nginx" ["date"]=> string(29) "Fri, 16 Jul 2021 16:32:22 GMT" ["content-type"]=> string(16) "application/json" ["x-powered-by"]=> string(10) "PHP/7.4.21" ["cache-control"]=> string(24) "private, must-revalidate" ["pragma"]=> string(8) "no-cache" ["expires"]=> string(2) "-1" ["x-ratelimit-limit"]=> string(2) "60" ["x-ratelimit-remaining"]=> string(2) "59" ["feature-policy"]=> string(251) "accelerometer 'self'; ambient-light-sensor 'self'; camera 'self'; fullscreen 'self'; geolocation 'self'; gyroscope 'self'; magnetometer 'self'; microphone 'self'; midi 'self'; payment 'self'; picture-in-picture *; speaker 'self'; usb 'self'; vr 'self'" ["strict-transport-security"]=> string(19) "max-age=10; preload" ["expect-ct"]=> string(10) "max-age=10" ["x-content-type-options"]=> string(7) "nosniff" ["x-download-options"]=> string(6) "noopen" ["x-frame-options"]=> string(10) "sameorigin" ["x-permitted-cross-domain-policies"]=> string(4)
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: composer detected issues in your platform: your composer dependencies require a php version ">= 7.3.0".
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.