stdClass Object ( [Order] => stdClass Object
( [id] => c62f5d272ghjjgd346lmn34
[type] => [status] => placed
[keys_status] => Keys were generated )
[Products] => Array ( [0] => stdClass Object ( [name] => Mobile Security
[devices] => 1 [months] => 12 [quantity] => 1 [msrp_price] => 9 [discount] => 0.0 [end_user_price] => 9 [reseller_margin] => 0.0 [reseller_price] => 9.01[partner_margin] => 90 [partner_price] => 0.9[Keys] => Array ( [0] => stdClass Object ( [product_id] => 21 [product_name] => Mobile Security [key] => 1234) ) ) ) [Customer] => stdClass Object ( [name] => IPPS [phone] => 25667587576 [address] => Bishop willis Street [contact_person] => Mukama Gordon [city] => Kigali [zipcode] => 250 [country_id] => 202 [state_id] => [email] => mukamatest#test.com ) [Keys] => Array ( [0] => stdClass Object ( [product_id] => 21 [product_name] => Mobile Security [key] => 1234 ) ) )
This is a really hacky way of doing it, but try
$arrayversion = json_decode(json_encode($objectversion), true);
Then
print_r($arrayversion); will be an array.
Related
I want to show flight's logo images in a flight list using flight offer price API:
https://developers.amadeus.com/self-service/category/air/api-doc/flight-offers-search/api-reference.
I search for flights using origin and destination, one way or round trip, etc. But the flight logo image is not available in the result. Is there a way I can get the flight logo image using the "flight-offers-search" API?
I have used bellow API URL to get flight offer price
This is my request URL
https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAN&destinationLocationCode=LAX&departureDate=2021-07-29&adults=1&travelClass=ECONOMY¤cyCode=USD&max=100
This is my API response. there is no flight logo image available in the response.
stdClass Object
(
[meta] => stdClass Object
(
[count] => 93
[links] => stdClass Object
(
[self] => https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAN&destinationLocationCode=LAX&departureDate=2021-07-29&adults=1&travelClass=ECONOMY¤cyCode=USD&max=100
)
)
[data] => Array
(
[0] => stdClass Object
(
[type] => flight-offer
[id] => 1
[source] => GDS
[instantTicketingRequired] =>
[nonHomogeneous] =>
[oneWay] =>
[lastTicketingDate] => 2021-07-29
[numberOfBookableSeats] => 4
[itineraries] => Array
(
[0] => stdClass Object
(
[duration] => PT29H42M
[segments] => Array
(
[0] => stdClass Object
(
[departure] => stdClass Object
(
[iataCode] => MAN
[terminal] => 1
[at] => 2021-07-29T10:40:00
)
[arrival] => stdClass Object
(
[iataCode] => LIS
[terminal] => 1
[at] => 2021-07-29T13:30:00
)
[carrierCode] => TP
[number] => 1317
[aircraft] => stdClass Object
(
[code] => 32N
)
[operating] => stdClass Object
(
[carrierCode] => TP
)
[duration] => PT2H50M
[id] => 152
[numberOfStops] => 0
[blacklistedInEU] =>
)
[1] => stdClass Object
(
[departure] => stdClass Object
(
[iataCode] => LIS
[terminal] => 1
[at] => 2021-07-29T18:30:00
)
[arrival] => stdClass Object
(
[iataCode] => EWR
[terminal] => B
[at] => 2021-07-29T21:30:00
)
[carrierCode] => TP
[number] => 207
[aircraft] => stdClass Object
(
[code] => 32Q
)
[operating] => stdClass Object
(
[carrierCode] => TP
)
[duration] => PT8H
[id] => 153
[numberOfStops] => 0
[blacklistedInEU] =>
)
[2] => stdClass Object
(
[departure] => stdClass Object
(
[iataCode] => JFK
[terminal] => 5
[at] => 2021-07-30T05:30:00
)
[arrival] => stdClass Object
(
[iataCode] => LAX
[terminal] => 3
[at] => 2021-07-30T08:22:00
)
[carrierCode] => TP
[number] => 4325
[aircraft] => stdClass Object
(
[code] => 32S
)
[operating] => stdClass Object
(
[carrierCode] => B6
)
[duration] => PT5H52M
[id] => 154
[numberOfStops] => 0
[blacklistedInEU] =>
)
)
)
)
[price] => stdClass Object
(
[currency] => USD
[total] => 845.85
[base] => 581.00
[fees] => Array
(
[0] => stdClass Object
(
[amount] => 0.00
[type] => SUPPLIER
)
[1] => stdClass Object
(
[amount] => 0.00
[type] => TICKETING
)
)
[grandTotal] => 845.85
)
[pricingOptions] => stdClass Object
(
[fareType] => Array
(
[0] => PUBLISHED
)
[includedCheckedBagsOnly] => 1
)
[validatingAirlineCodes] => Array
(
[0] => TP
)
[travelerPricings] => Array
(
[0] => stdClass Object
(
[travelerId] => 1
[fareOption] => STANDARD
[travelerType] => ADULT
[price] => stdClass Object
(
[currency] => USD
[total] => 845.85
[base] => 581.00
)
[fareDetailsBySegment] => Array
(
[0] => stdClass Object
(
[segmentId] => 152
[cabin] => ECONOMY
[fareBasis] => LUKBSI0D
[class] => L
[includedCheckedBags] => stdClass Object
(
[quantity] => 1
)
)
[1] => stdClass Object
(
[segmentId] => 153
[cabin] => ECONOMY
[fareBasis] => LUKBSI0D
[class] => L
[includedCheckedBags] => stdClass Object
(
[quantity] => 1
)
)
[2] => stdClass Object
(
[segmentId] => 154
[cabin] => ECONOMY
[fareBasis] => LUKBSI0D
[brandedFare] => BASIC
[class] => L
[includedCheckedBags] => stdClass Object
(
[quantity] => 1
)
)
)
)
)
)
Or anyone know if there are any other api's that I can use to get the logos?
Please help to get flight logo using Amadeus API
I have used Amadeus test API
Thank you
This question already has an answer here:
How to extract and access data from JSON with PHP?
(1 answer)
Closed 3 years ago.
i have data in json something like that:
stdClass Object
(
[contacts] => stdClass Object
(
[14] => stdClass Object
(
[data] => stdClass Object
(
[email] => veer#gmail.com
[first_name] => veer
[last_name] =>
[user_id] => 16
[owner_id] => 0
[optin_status] => 0
[date_created] => 2020-01-20 13:14:54
[ID] => 14
[gravatar] => http://localhost:8888/wordpress/wp-content/themes/wp_lms/assets/images/avatar.jpg
[age] =>
)
[meta] => stdClass Object
(
[preferences_changed] => 1579526094
[user_login] => veer
[profile_picture] => http://localhost:8888/wordpress/wp-content/themes/wp_lms/assets/images/avatar.jpg
[birthday] =>
)
[tags] => Array
(
[0] => 92
[1] => 13
[2] => 12
[3] => 9
)
[files] => Array
(
)
)
[9] => stdClass Object
(
[data] => stdClass Object
(
[email] => singh.pratibha1432#gmail.com
[first_name] => Pratibha
[last_name] => Singh
[user_id] => 8
[owner_id] => 0
[optin_status] => 0
[date_created] => 2020-01-20 13:14:54
[ID] => 9
[gravatar] => http://localhost:8888/wordpress/wp-content/themes/wp_lms/assets/images/avatar.jpg
[age] =>
)
[meta] => stdClass Object
(
[preferences_changed] => 1579526094
[user_login] => pratibha
[profile_picture] => http://localhost:8888/wordpress/wp-content/themes/wp_lms/assets/images/avatar.jpg
[birthday] =>
)
[tags] => Array
(
[0] => 94
[1] => 93
[2] => 92
[3] => 91
[4] => 82
[5] => 15
[6] => 14
[7] => 13
[8] => 9
)
[files] => Array
(
)
)
[4] => stdClass Object
(
[data] => stdClass Object
(
[email] => singh.dev1432#gmail.com
[first_name] => Devesh
[last_name] => Singh
[user_id] => 7
[owner_id] => 0
[optin_status] => 0
[date_created] => 2020-01-20 13:14:54
[ID] => 4
[gravatar] => http://localhost:8888/wordpress/wp-content/themes/wp_lms/assets/images/avatar.jpg
[age] =>
)
[meta] => stdClass Object
(
[preferences_changed] => 1579526094
[user_login] => devesh
[profile_picture] => http://localhost:8888/wordpress/wp-content/themes/wp_lms/assets/images/avatar.jpg
[birthday] =>
)
[tags] => Array
(
[0] => 93
[1] => 92
[2] => 15
[3] => 12
[4] => 11
[5] => 9
)
[files] => Array
(
)
)
[2] => stdClass Object
(
[data] => stdClass Object
(
[email] => admin#gmail.com
[first_name] => veronica
[last_name] =>
[user_id] => 1
[owner_id] => 0
[optin_status] => 0
[date_created] => 2020-01-20 13:14:54
[ID] => 2
[gravatar] => http://localhost:8888/wordpress/wp-content/uploads/avatars/1/5dc525d984494-bpfull.jpg
[age] =>
)
[meta] => stdClass Object
(
[preferences_changed] => 1579526094
[user_login] => admin
[profile_picture] => http://localhost:8888/wordpress/wp-content/uploads/avatars/1/5dc525d984494-bpfull.jpg
[birthday] =>
)
[tags] => Array
(
[0] => 94
[1] => 92
[2] => 15
[3] => 14
[4] => 13
[5] => 9
)
[files] => Array
(
)
)
)
[status] => success
)
and now I am trying to fetch "email" from the contacts->id->data->email so for that i am using this code. I am trying to loop the things by which i can fetch email from all the ids present. and in the ids section, there is data and inside data the email is present so how can i fetch all emails from all the ids.
foreach ((Array)$body->contacts as $id => $values) {
foreach ($values as $data => $value) {
$emails = array('email'=>$value->email);
return $emails;
}
}
but it return only single data:
Array
(
[email] => veer#gmail.com
)
i want to fetch all the email like that:
Array
(
[0] => Array
(
[emails] => veer#gmail.com
)
[1] => Array
(
[emails] => singh.pratibha1432#gmail.com
)
[2] => Array
(
[emails] => singh.dev1432#gmail.com
)
[3] => Array
(
[emails] => admin#gmail.com
)
)
how can I achieve this?
Define null array and in foreach run store every email in that variable.
$emails = array();
foreach ((Array)$body->contacts as $id => $values) {
foreach ($values as $data => $value) {
$emails[] = array('emails'=>$contact->data->email;);
}
}
return $emails;
I am trying to get the value of bank_name in php. Can't get it to display.
stdClass Object ( [account_id] => 43726384 [name] => Account Name [state] => action_required [description] => [owner_user_id] =>[type] => personal [create_time] => 1477684534 [disablement_time] => [country] => US [currencies] => Array ( [0] => USD ) [action_reasons] => Array ( [0] => kyc [1] => bank_account ) [disabled_reasons] => Array ( ) [image_uri] => [supported_card_types] => Array ( [0] => visa [1] => mastercard [2] => american_express [3] => discover [4] => jcb [5] => diners_club ) [gaq_domains] => Array ( [0] => ) [balances] => Array ( [0] => stdClass Object ( [balance] => 0 [currency] => USD [disputed_amount] => 0 [incoming_pending_amount] => 0 [outgoing_pending_amount] => 0 [reserved_amount] => 0 [bank_name] => Bank Of America [withdrawal_next_time] => [withdrawal_period] => [withdrawal_type] => ) ) [statuses] => Array ( [0] => stdClass Object ( [currency] => USD [incoming_payments_status] => ok [outgoing_payments_status] => paused [account_review_status] => not_requested ) ) )
It's not very clear if you display data that way, but I think this would be the way to access to bank_name:
$bankName = $object->balances[0]->bank_name;
(If it doesn't work, please show the XML before parsing it to an object)
I have obtained the list of media id. for eg.
$media_id = 1147661250940270414_242644508
Now, as i have saved the media id already. i now want to fetch other detail information instantly using web services. Below is what i have tried but got no luck.
$url = 'https://api.instagram.com/v1/media/'.$media_id.'?access_token='.$myaccess_token;
$response = file_get_contents($url);
$response = json_decode($response);
print_r($response);
Reference from instagram documentation. how could i debug ?
Note : i have enabled curl. The above prints nothing.
Also printing $url and browsing prints json data.
What exactly is wrong for you? It is working perfectly with my access token and your media_id. The result is:
stdClass Object ( [meta] => stdClass Object ( [code] => 200 ) [data] => stdClass Object ( [attribution] => [tags] => Array ( [0] => summer [1] => merrychristmas [2] => love [3] => christmas [4] => family ) [type] => image [location] => [comments] => stdClass Object ( [count] => 0 [data] => Array ( ) ) [filter] => Rise [created_time] => 1451031904 [link] => https://www.instagram.com/p/_tT9PAxndO/ [likes] => stdClass Object ( [count] => 6 [data] => Array ( [0] => stdClass Object ( [username] => nedz3388 [profile_picture] => https://igcdn-photos-e-a.akamaihd.net/hphotos-ak-xft1/t51.2885-19/11296865_494353930737804_199912633_a.jpg [id] => 245135480 [full_name] => Nerida Cole ) [1] => stdClass Object ( [username] => ashleyhughesxixii [profile_picture] => https://igcdn-photos-e-a.akamaihd.net/hphotos-ak-xfp1/t51.2885-19/s150x150/12292658_1933982046828004_675035842_a.jpg [id] => 8121980 [full_name] => AshleyHughes ) [2] => stdClass Object ( [username] => beccao88 [profile_picture] => https://igcdn-photos-e-a.akamaihd.net/hphotos-ak-xtp1/t51.2885-19/s150x150/11374242_179260799080196_1224064424_a.jpg [id] => 145580378 [full_name] => Rebecca Ormond ) [3] => stdClass Object ( [username] => love_the_shred [profile_picture] => https://igcdn-photos-h-a.akamaihd.net/hphotos-ak-xat1/t51.2885-19/s150x150/10932468_1606801716246599_1519881141_a.jpg [id] => 248027596 [full_name] => Tony Young ) ) ) [images] => stdClass Object ( [low_resolution] => stdClass Object ( [url] => https://scontent.cdninstagram.com/hphotos-xfp1/t51.2885-15/s320x320/e35/12357934_1011207135587426_1185326237_n.jpg [width] => 320 [height] => 320 ) [thumbnail] => stdClass Object ( [url] => https://scontent.cdninstagram.com/hphotos-xfp1/t51.2885-15/s150x150/e35/12357934_1011207135587426_1185326237_n.jpg [width] => 150 [height] => 150 ) [standard_resolution] => stdClass Object ( [url] => https://scontent.cdninstagram.com/hphotos-xfp1/t51.2885-15/s640x640/sh0.08/e35/12357934_1011207135587426_1185326237_n.jpg [width] => 640 [height] => 640 ) ) [users_in_photo] => Array ( ) [caption] => stdClass Object ( [created_time] => 1451031904 [text] => Merry Christmas to all xx #christmas #merrychristmas #family #love #summer [from] => stdClass Object ( [username] => brooklyne91 [profile_picture] => https://igcdn-photos-a-a.akamaihd.net/hphotos-ak-xaf1/t51.2885-19/s150x150/12276893_1526872547628928_24812970_a.jpg [id] => 242644508 [full_name] => Broooke Ellis ) [id] => 1147661252576048439 ) [user_has_liked] => [id] => 1147661250940270414_242644508 [user] => stdClass Object ( [username] => brooklyne91 [profile_picture] => https://igcdn-photos-a-a.akamaihd.net/hphotos-ak-xaf1/t51.2885-19/s150x150/12276893_1526872547628928_24812970_a.jpg [id] => 242644508 [full_name] => Broooke Ellis ) ) )
Then you can split this data individually to how you please.
I download the ShippingGroundFreightWebService PHP examples from UPS.com. I got following error message:
SoapFault Object
(
[message:protected] => An exception has been raised as a result of client data.
[string:private] =>
[code:protected] => 0
[file:protected] => /home5/vizparts/public_html/PHP/SoapGroundFreightShipClient.php
[line:protected] => 193
[trace:private] => Array
(
[0] => Array
(
[file] => /home5/vizparts/public_html/PHP/SoapGroundFreightShipClient.php
[line] => 193
[function] => __soapCall
[class] => SoapClient
[type] => ->
[args] => Array
(
[0] => ProcessShipment
[1] => Array
(
[0] => Array
(
[Request] => Array
(
[RequestOption] => Array
(
[0] => 1
[1] => Shipping
)
)
[Shipment] => Array
(
[ShipFrom] => Array
(
[Name] => Pat Stewart
[TaxIdentification] => 1234567890
[Address] => Array
(
[AddressLine] => 2311 York Road
[City] => Timonium
[StateProvinceCode] => MD
[PostalCode] => 21093
[CountryCode] => US
)
[AttentionName] => String
[Phone] => Array
(
[Number] => 6785851000
[Extension] => 123
)
)
[ShipperNumber] => 222006
[ShipTo] => Array
(
[Name] => Superman
[Address] => Array
(
[AddressLine] => 2010 Warsaw Road
[StateProvinceCode] => GA
[PostalCode] => 30076
[CountryCode] => US
[City] => Roswell
)
[AttentionName] => String
[Phone] => Array
(
[Number] => 6785851000
[Extention] => 111
)
)
[PaymentInformation] => Array
(
[Payer] => Array
(
[Name] => Superman
[Address] => Array
(
[AddressLine] => 2010 Warsaw Road
[City] => Roswell
[StateProvinceCode] => GA
[PostalCode] => 30075
[CountryCode] => US
)
[ShipperNumber] => 00613270
[AttentionName] => String
[Phone] => Array
(
[Number] => 6785851000
)
)
[ShipmentBillingOption] => Array
(
[Code] => 10
[Description] => String
)
)
[Service] => Array
(
[Code] => 308
[Description] => String
)
[HandlingUnitOne] => Array
(
[Quantity] => 16
[Type] => Array
(
[Code] => PLT
[Description] => String
)
)
[Commodity] => Array
(
[CommodityID] => 22
[Description] => BUGS
[Weight] => Array
(
[UnitOfMeasurement] => Array
(
[Code] => LBS
[Description] => String
)
[Value] => 511.25
)
[Dimensions] => Array
(
[UnitOfMeasurement] => Array
(
[Code] => IN
[Description] => String
)
[Length] => 1.25
[Width] => 1.2
[Height] => 5
)
[NumberOfPieces] => 1
[PackagingType] => Array
(
[Code] => PLT
[Description] => String
)
[CommodityValue] => Array
(
[CurrencyCode] => USD
[MonetaryValue] => 265.2
)
[FreightClass] => 60
[NMFCCommodityCode] => 566
)
[Reference] => Array
(
[Number] => Array
(
[Code] => PM
[Value] => 1651651616
)
[BarCodeIndicator] => Array
(
[NumberOfCartons] => 5
[Weight] => Array
(
[UnitOfMeasurement] => Array
(
[Code] => LBS
[Description] => String
)
[Value] => 2
)
)
)
)
)
)
)
)
)
[faultstring] => An exception has been raised as a result of client data.
[faultcode] => Client
[faultcodens] => http://schemas.xmlsoap.org/soap/envelope/
[detail] => stdClass Object
(
[Errors] => stdClass Object
(
[ErrorDetail] => stdClass Object
(
[Severity] => Hard
[PrimaryErrorCode] => stdClass Object
(
[Code] => 9121000
[Description] => Invalid Ship Request Document
)
)
)
)
)
I want to integrate the UPS API into my own website. I want to print the shipping label. How to fix this problem?
you should set the request xsd file,find it in other folder in the package you download.then set the request file with it.