I got array value from API.
model\Quote Object
(
[quote_reference:protected] => 12345
[proposals:protected] => model\Proposals Object
(
[proposal:protected] => Array
(
[0] => model\Proposal Object
(
[id:protected] => prp_3453453453sdfsd
[fees_included:protected] => 1
[charged_amount:protected] => model\Amount Object
(
[currency:protected] => USD
[amount:protected] => 105.00
)
[credited_amount:protected] => model\Amount Object
(
[currency:protected] => MAD
[amount:protected] => 1000.00
)
[principal_amount:protected] => model\Amount Object
(
[currency:protected] => USD
[amount:protected] => 100.00
)
[expiration_date:protected] => DateTime Object
(
[date] => 2016-04-07 02:12:55.682000
[timezone_type] => 1
[timezone] => -05:00
)
[destination_service_tag:protected] =>
[corridor_tag:protected] =>
[resource_type:protected] => proposal
[additional_data_list:protected] => model\AdditionalDataList Object
(
[data:protected] => model\Data Object
(
[data_field:protected] => Array
(
[0] => model\DataField Object
(
[name:protected] => 811
[value:protected] => 123
)
[1] => model\DataField Object
(
[name:protected] => 851
[value:protected] => 456
)
)
)
[item_count:protected] => 2
[resource_type:protected] => list
)
[wholesale_fx_rate:protected] =>
)
[1] => model\Proposal Object
(
[id:protected] => prp_456sgdfgsdfg [fees_included:protected] => 1
[charged_amount:protected] => model\Amount Object
(
[currency:protected] => USD
[amount:protected] => 100.00
)
[credited_amount:protected] => model\Amount Object
(
[currency:protected] => MAD
[amount:protected] => 950.00
)
[principal_amount:protected] => model\Amount Object
(
[currency:protected] => USD
[amount:protected] => 100.00
)
[expiration_date:protected] => DateTime Object
(
[date] => 2016-04-07 02:22:55.682000
[timezone_type] => 1
[timezone] => -05:00
)
[destination_service_tag:protected] =>
[corridor_tag:protected] =>
[resource_type:protected] => proposal
[additional_data_list:protected] => model\AdditionalDataList Object
(
[data:protected] => model\Data Object
(
[data_field:protected] => Array
(
[0] => model\DataField Object
(
[name:protected] => 811
[value:protected] => 123
)
[1] => model\DataField Object
(
[name:protected] => 851
[value:protected] => 456
)
)
)
[item_count:protected] => 2
[resource_type:protected] => list
)
[wholesale_fx_rate:protected] =>
)
)
)
)
I need to access both proposal array values at 0 and 1 index position.
I Tried:
$arrayobject->proposals->proposal[0];
Getting error:
Fatal error: Cannot access protected property model\Quote::$proposal
Any idea or help would be appreciated.
Thanks!
Related
I want to implement pagination using "Flight Offers Search" of Amadeus API. There is no parameter to passing limit and offset using "Flight Offers Search" of Amadeus API.
I have bellow API URL with filter parameter to get flight list
https://api.amadeus.com/v2/shopping/flight-offers?originLocationCode=JFK&destinationLocationCode=LHR&departureDate=2021-09-02&returnDate=2021-09-05&adults=1&travelClass=ECONOMY¤cyCode=USD&max=10
And I got response from API like this
stdClass Object
(
[meta] => stdClass Object
(
[count] => 10
[links] => stdClass Object
(
[self] => https://api.amadeus.com/v2/shopping/flight-offers?originLocationCode=JFK&destinationLocationCode=LHR&departureDate=2021-09-02&returnDate=2021-09-05&adults=1&travelClass=ECONOMY¤cyCode=USD&max=10
)
)
[data] => Array
(
[0] => stdClass Object
(
[type] => flight-offer
[id] => 1
[source] => GDS
[instantTicketingRequired] =>
[nonHomogeneous] =>
[oneWay] =>
[lastTicketingDate] => 2021-08-28
[numberOfBookableSeats] => 9
[itineraries] => Array
(
[0] => stdClass Object
(
[duration] => PT6H50M
[segments] => Array
(
[0] => stdClass Object
(
[departure] => stdClass Object
(
[iataCode] => JFK
[terminal] => 4
[at] => 2021-09-02T08:15:00
)
[arrival] => stdClass Object
(
[iataCode] => LHR
[terminal] => 3
[at] => 2021-09-02T20:05:00
)
[carrierCode] => VS
[number] => 26
[aircraft] => stdClass Object
(
[code] => 789
)
[operating] => stdClass Object
(
[carrierCode] => VS
)
[duration] => PT6H50M
[id] => 3
[numberOfStops] => 0
[blacklistedInEU] =>
)
)
)
[1] => stdClass Object
(
[duration] => PT8H15M
[segments] => Array
(
[0] => stdClass Object
(
[departure] => stdClass Object
(
[iataCode] => LHR
[terminal] => 3
[at] => 2021-09-05T10:10:00
)
[arrival] => stdClass Object
(
[iataCode] => JFK
[terminal] => 4
[at] => 2021-09-05T13:25:00
)
[carrierCode] => VS
[number] => 4007
[aircraft] => stdClass Object
(
[code] => 764
)
[operating] => stdClass Object
(
[carrierCode] => DL
)
[duration] => PT8H15M
[id] => 8
[numberOfStops] => 0
[blacklistedInEU] =>
)
)
)
)
[price] => stdClass Object
(
[currency] => USD
[total] => 709.86
[base] => 122.00
[fees] => Array
(
[0] => stdClass Object
(
[amount] => 0.00
[type] => SUPPLIER
)
[1] => stdClass Object
(
[amount] => 0.00
[type] => TICKETING
)
)
[grandTotal] => 709.86
)
[pricingOptions] => stdClass Object
(
[fareType] => Array
(
[0] => PUBLISHED
)
[includedCheckedBagsOnly] =>
)
[validatingAirlineCodes] => Array
(
[0] => VS
)
[travelerPricings] => Array
(
[0] => stdClass Object
(
[travelerId] => 1
[fareOption] => STANDARD
[travelerType] => ADULT
[price] => stdClass Object
(
[currency] => USD
[total] => 709.86
[base] => 122.00
)
[fareDetailsBySegment] => Array
(
[0] => stdClass Object
(
[segmentId] => 3
[cabin] => ECONOMY
[fareBasis] => NH3X36B1
[brandedFare] => LIGHT
[class] => T
[includedCheckedBags] => stdClass Object
(
[quantity] => 0
)
)
[1] => stdClass Object
(
[segmentId] => 8
[cabin] => ECONOMY
[fareBasis] => NH3X36B1
[brandedFare] => LIGHT
[class] => T
[includedCheckedBags] => stdClass Object
(
[quantity] => 0
)
)
)
)
)
)
)
[dictionaries] => stdClass Object
(
[locations] => stdClass Object
(
[LHR] => stdClass Object
(
[cityCode] => LON
[countryCode] => GB
)
[JFK] => stdClass Object
(
[cityCode] => NYC
[countryCode] => US
)
)
[aircraft] => stdClass Object
(
[772] => BOEING 777-200/200ER
[764] => BOEING 767-400
[77W] => BOEING 777-300ER
[777] => BOEING 777-200/300
[789] => BOEING 787-9
)
[currencies] => stdClass Object
(
[USD] => US DOLLAR
)
[carriers] => stdClass Object
(
[AA] => AMERICAN AIRLINES
[KL] => KLM ROYAL DUTCH AIRLINES
[AF] => AIR FRANCE
[DL] => DELTA AIR LINES
[AY] => FINNAIR
[VS] => VIRGIN ATLANTIC
[BA] => BRITISH AIRWAYS
)
)
)
There is no limit and offset parameter in this API.
Please guide me how to implement pagination using "Flight Offers Search" of Amadeus API.
Thank You
The Flight Offers Search API doesn't support pagination, that's why there are not parameters available to pass the limit and offset in the API reference. Checkout the pagination guide for more information.
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
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 want to change the below object serialize values for 'secret_key' and 'public_key' and then i have to unserialize again.
What is the best way to modify (without string replace option)?
__PHP_Incomplete_Class Object
(
[__PHP_Incomplete_Class_Name] => RulesReactionRule
[*parent] =>
[id] => 51
[*elementId] => 1
[weight] => 0
[settings] => Array
(
)
[name] => commerce_payment_commerce_stripe
[label] => Stripe
[plugin] => reaction rule
[active] => 1
[status] => 3
[dirty] =>
[module] => commerce_payment
[owner] => rules
[access_exposed] => 0
[data] => __PHP_Incomplete_Class Object
*RECURSION*
[tags] => Array
(
[0] => Commerce Payment
)
[*children] => Array
(
[0] => __PHP_Incomplete_Class Object
(
[__PHP_Incomplete_Class_Name] => RulesAction
[*parent] => __PHP_Incomplete_Class Object
*RECURSION*
[id] =>
[*elementId] => 3
[weight] => 0
[settings] => Array
(
[commerce_order:select] => commerce-order
[payment_method] => Array
(
[method_id] => commerce_stripe
[settings] => Array
(
[stripe_currency] => USD
[secret_key] => sk_test_CCVVVVCC
[public_key] => pk_test_SDFFEFEF
[display_title] => Stripe
[cardonfile] => 1
[txn_type] => authorize
)
)
)
[*elementName] => commerce_payment_enable_commerce_stripe
)
)
[*info] => Array
(
)
[*conditions] => __PHP_Incomplete_Class Object
(
[__PHP_Incomplete_Class_Name] => RulesAnd
[*parent] => __PHP_Incomplete_Class Object
*RECURSION*
[id] =>
[*elementId] => 2
[weight] => 0
[settings] => Array
(
)
[*children] => Array
(
)
[*info] => Array
(
)
[*negate] =>
)
[*events] => Array
(
[0] => commerce_payment_methods
)
[*eventSettings] => Array
(
)
)
I am trying to access data inside a php object. I am confused about what the exact stynax is. Here is the output of the object:
stdClass Object ( [vid] => 10 [uid] => 1 [title] => Beachhead Don [log] =>
[status] => 1 [comment] => 1 [promote] => 0 [sticky] => 0 [ds_switch] => [nid] =>
10 [type] => product [language] => und [created] => 1357668665 [changed] => 1358198386
[tnid] => 0 [translate] => 0 [revision_timestamp] => 1358198386 [revision_uid] => 1
[model] => B 3000 [list_price] => 0.00000 [cost] => 0.00000 [sell_price] => 1.00000
[weight] => 0 [weight_units] => lb [length] => 0 [width] => 0 [height] => 0
[length_units] => in [pkg_qty] => 1 [default_qty] => 1 [unique_hash] =>
2eec0fcc8483f3a3541870fb24223296 [ordering] => 0 [shippable] => 0 [price] => 1.00000
[body] => Array ( [und] => Array ( [0] => Array ( [value] => Description info
))))))))))))))))))))))))))))))))))))))0 [summary] => [format] => filtered_html
[safe_value] =>Description info ))))))))))))))))))))))))))))))))))))))0[safe_summary]
=> ) ) ) [uc_product_image] => Array ( [und] => Array ( [0] => Array ( [fid] => 11
[alt] => [title] => [width] => 90 [height] => 120 [uid] => 1 [filename] =>
beachhead_don.jpg [uri] => public://beachhead_don.jpg [filemime] => image/jpeg
[filesize] => 14342 [status] => 1 [timestamp] => 1357668665 [rdf_mapping] => Array ( )
) ) ) [field_author] => Array ( [und] => Array ( [0] => Array ( [value] => John B.
Romesier [format] => [safe_value] => John B. Romesier ) ) ) [field_publisher] => Array
( [und] => Array ( [0] => Array ( [value] => Unknown [format] => [safe_value] =>
Unknown ) ) ) [field_release_date] => Array ( [und] => Array ( [0] => Array ( [value]
=> Mar 2012 [format] => [safe_value] => Mar 2012 ) ) ) [field_number_of_pages] => Array
( [und] => Array ( [0] => Array ( [value] => 123 ) ) ) [field_catagory] => Array (
[und] => Array ( [0] => Array ( [tid] => 4 ) ) ) [field_book_type] => Array ( [und] => Array ( [0] => Array ( [tid] => 1 ) ) ) [field_isbn] => Array ( ) [field_about_the_author] => Array ( [und] => Array ( [0] => Array ( [value] => Beachhed Don authoer............................ [format] => [safe_value] => Beachhed Don authoer............................ ) ) ) [rdf_mapping] => Array ( [rdftype] => Array ( [0] => sioc:Item [1] => foaf:Document ) [title] => Array ( [predicates] => Array ( [0] => dc:title ) ) [created] => Array ( [predicates] => Array ( [0] => dc:date [1] => dc:created ) [datatype] => xsd:dateTime [callback] => date_iso8601 ) [changed] => Array ( [predicates] => Array ( [0] => dc:modified ) [datatype] => xsd:dateTime [callback] => date_iso8601 ) [body] => Array ( [predicates] => Array ( [0] => content:encoded ) ) [uid] => Array ( [predicates] => Array ( [0] => sioc:has_creator ) [type] => rel ) [name] => Array ( [predicates] => Array ( [0] => foaf:name ) ) [comment_count] => Array ( [predicates] => Array ( [0] => sioc:num_replies ) [datatype] => xsd:integer ) [last_activity] => Array ( [predicates] => Array ( [0] => sioc:last_activity_date ) [datatype] => xsd:dateTime [callback] => date_iso8601 ) ) [cid] => 0 [last_comment_timestamp] => 1357668665 [last_comment_name] => [last_comment_uid] => 1 [comment_count] => 0 [name] => admin [picture] => 0 [data] => b:0; [entity_view_prepared] => 1 )
I am trying to retrive the [value] of Description info ))))))))))))))))))))))))))))))))))))))0
I tried this
<?php
$node = menu_get_object(); //drupal code
if ( !empty($node) ) {
print $node ->body=>und=>0=>value;
}?>
and got an error about the '=' sign. What is the proper way to get my data?
[body] and [und] are arrays, so access them like this:
echo $node->body['und'][0]['value'];
It should be:
$node->body['und'][0]['value']
'Body' and 'und' are Arrays and need to be accessed with array syntax([]).
Accessing these values directly is sometimes frowned upon in drupal. You may want to look into: http://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_render/7