Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I can return nothing by trying to access the array like this:
$title = $response->Items->Item->ItemAttributes->Title;
$ISBN = $response->Items->Item->ItemAttributes->ISBN;
Any Help?
print_r($response) returns:
Array
(
[OperationRequest] => stdClass Object
(
[HTTPHeaders] => stdClass Object
(
[Header] => stdClass Object
(
[Name] => UserAgent
[Value] => PHP-SOAP/5.3.24
)
)
[RequestId] => 827356ca-4459-45b3-abed-f4abf17e50ee
[Arguments] => stdClass Object
(
[Argument] => stdClass Object
(
[Name] => Service
[Value] => AWSECommerceService
)
)
[RequestProcessingTime] => 0.186987
)
[Items] => stdClass Object
(
[Request] => stdClass Object
(
[IsValid] => True
[ItemSearchRequest] => stdClass Object
(
[Keywords] => 1933916958
[ResponseGroup] => Large
[SearchIndex] => Books
)
)
[TotalResults] => 1
[TotalPages] => 1
[MoreSearchResultsUrl] => http://www.amazon.com/gp/redirect.html?camp=2025&creative=386001&location=http%3A%2F%2Fwww.amazon.com%2Fgp%2Fsearch%3Fkeywords%3D1933916958%26url%3Dsearch-alias%253Dstripbooks&linkCode=sp1&tag=&SubscriptionId=
[Item] => stdClass Object
(
[ASIN] => 1933916958
[DetailPageURL] => http://www.amazon.com/I-Am-Stumped-Lisa-Rivard/dp/1933916958%3FSubscriptionId%3D%26tag%3D%26linkCode%3Dsp1%26camp%3D2025%26creative%3D165953%26creativeASIN%3D1933916958
[ItemLinks] => stdClass Object
(
[ItemLink] => Array
(
[0] => stdClass Object
(
[Description] => Technical Details
[URL] => http://www.amazon.com/I-Am-Stumped-Lisa-Rivard/dp/tech-data/1933916958%3FSubscriptionId%3D%26tag%3D%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D1933916958
)
[1] => stdClass Object
(
[Description] => Add To Baby Registry
[URL] => http://www.amazon.com/gp/registry/baby/add-item.html%3Fasin.0%3D1933916958%26SubscriptionId%3D%26tag%3D%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D1933916958
)
[2] => stdClass Object
(
[Description] => Add To Wedding Registry
[URL] => http://www.amazon.com/gp/registry/wedding/add-item.html%3Fasin.0%3D1933916958%26SubscriptionId%3D%26tag%3D%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D1933916958
)
[3] => stdClass Object
(
[Description] => Add To Wishlist
[URL] => http://www.amazon.com/gp/registry/wishlist/add-item.html%3Fasin.0%3D1933916958%26SubscriptionId%3D%26tag%3D%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D1933916958
)
[4] => stdClass Object
(
[Description] => Tell A Friend
[URL] => http://www.amazon.com/gp/pdp/taf/1933916958%3FSubscriptionId%3D%26tag%3D%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D1933916958
)
[5] => stdClass Object
(
[Description] => All Customer Reviews
[URL] => http://www.amazon.com/review/product/1933916958%3FSubscriptionId%3D%26tag%3D%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D1933916958
)
[6] => stdClass Object
(
[Description] => All Offers
[URL] => http://www.amazon.com/gp/offer-listing/1933916958%3FSubscriptionId%3D%26tag%3D%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D1933916958
)
)
)
[SalesRank] => 2163913
[SmallImage] => stdClass Object
(
[URL] => http://ecx.images-amazon.com/images/I/51vOOdcil6L._SL75_.jpg
[Height] => stdClass Object
(
[_] => 75
[Units] => pixels
)
[Width] => stdClass Object
(
[_] => 75
[Units] => pixels
)
)
[MediumImage] => stdClass Object
(
[URL] => http://ecx.images-amazon.com/images/I/51vOOdcil6L._SL160_.jpg
[Height] => stdClass Object
(
[_] => 160
[Units] => pixels
)
[Width] => stdClass Object
(
[_] => 160
[Units] => pixels
)
)
[LargeImage] => stdClass Object
(
[URL] => http://ecx.images-amazon.com/images/I/51vOOdcil6L.jpg
[Height] => stdClass Object
(
[_] => 500
[Units] => pixels
)
[Width] => stdClass Object
(
[_] => 500
[Units] => pixels
)
)
[ImageSets] => stdClass Object
(
[ImageSet] => stdClass Object
(
[SwatchImage] => stdClass Object
(
[URL] => http://ecx.images-amazon.com/images/I/51vOOdcil6L._SL30_.jpg
[Height] => stdClass Object
(
[_] => 30
[Units] => pixels
)
[Width] => stdClass Object
(
[_] => 30
[Units] => pixels
)
)
[SmallImage] => stdClass Object
(
[URL] => http://ecx.images-amazon.com/images/I/51vOOdcil6L._SL75_.jpg
[Height] => stdClass Object
(
[_] => 75
[Units] => pixels
)
[Width] => stdClass Object
(
[_] => 75
[Units] => pixels
)
)
[ThumbnailImage] => stdClass Object
(
[URL] => http://ecx.images-amazon.com/images/I/51vOOdcil6L._SL75_.jpg
[Height] => stdClass Object
(
[_] => 75
[Units] => pixels
)
[Width] => stdClass Object
(
[_] => 75
[Units] => pixels
)
)
[TinyImage] => stdClass Object
(
[URL] => http://ecx.images-amazon.com/images/I/51vOOdcil6L._SL110_.jpg
[Height] => stdClass Object
(
[_] => 110
[Units] => pixels
)
[Width] => stdClass Object
(
[_] => 110
[Units] => pixels
)
)
[MediumImage] => stdClass Object
(
[URL] => http://ecx.images-amazon.com/images/I/51vOOdcil6L._SL160_.jpg
[Height] => stdClass Object
(
[_] => 160
[Units] => pixels
)
[Width] => stdClass Object
(
[_] => 160
[Units] => pixels
)
)
[LargeImage] => stdClass Object
(
[URL] => http://ecx.images-amazon.com/images/I/51vOOdcil6L.jpg
[Height] => stdClass Object
(
[_] => 500
[Units] => pixels
)
[Width] => stdClass Object
(
[_] => 500
[Units] => pixels
)
)
[Category] => primary
)
)
[ItemAttributes] => stdClass Object
(
[Author] => Lisa Rivard
[Binding] => Paperback
[Creator] => stdClass Object
(
[_] => Colleen Murray Fisher
[Role] => Illustrator
)
[EAN] => 9781933916958
[EANList] => stdClass Object
(
[EANListElement] => 9781933916958
)
[ISBN] => 1933916958
[ItemDimensions] => stdClass Object
(
[Height] => stdClass Object
(
[_] => 878
[Units] => hundredths-inches
)
[Length] => stdClass Object
(
[_] => 31
[Units] => hundredths-inches
)
[Weight] => stdClass Object
(
[_] => 30
[Units] => hundredths-pounds
)
[Width] => stdClass Object
(
[_] => 866
[Units] => hundredths-inches
)
)
[Label] => Ferne Press
[Languages] => stdClass Object
(
[Language] => Array
(
[0] => stdClass Object
(
[Name] => English
[Type] => Unknown
)
[1] => stdClass Object
(
[Name] => English
[Type] => Original Language
)
[2] => stdClass Object
(
[Name] => English
[Type] => Published
)
)
)
[ListPrice] => stdClass Object
(
[Amount] => 1095
[CurrencyCode] => USD
[FormattedPrice] => $10.95
)
[Manufacturer] => Ferne Press
[NumberOfItems] => 1
[NumberOfPages] => 32
[PackageDimensions] => stdClass Object
(
[Height] => stdClass Object
(
[_] => 30
[Units] => hundredths-inches
)
[Length] => stdClass Object
(
[_] => 890
[Units] => hundredths-inches
)
[Weight] => stdClass Object
(
[_] => 35
[Units] => hundredths-pounds
)
[Width] => stdClass Object
(
[_] => 880
[Units] => hundredths-inches
)
)
[ProductGroup] => Book
[ProductTypeName] => ABIS_BOOK
[PublicationDate] => 2012-02-15
[Publisher] => Ferne Press
[SKU] => 38594
[Studio] => Ferne Press
[Title] => I Am Stumped!
)
[OfferSummary] => stdClass Object
(
[LowestNewPrice] => stdClass Object
(
[Amount] => 652
[CurrencyCode] => USD
[FormattedPrice] => $6.52
)
[LowestUsedPrice] => stdClass Object
(
[Amount] => 1
[CurrencyCode] => USD
[FormattedPrice] => $0.01
)
[TotalNew] => 9
[TotalUsed] => 6
[TotalCollectible] => 0
[TotalRefurbished] => 0
)
[Offers] => stdClass Object
(
[TotalOffers] => 1
[TotalOfferPages] => 1
[MoreOffersUrl] => http://www.amazon.com/gp/offer-listing/1933916958%3FSubscriptionId%3D%26tag%3D%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D1933916958
[Offer] => stdClass Object
(
[OfferAttributes] => stdClass Object
(
[Condition] => New
)
[OfferListing] => stdClass Object
(
[OfferListingId] => aHNL56yCKgoOwR9cqtskiy8iY%2B6ft1PDE%2FNUX7mlIfBkGcVKgCxSkvahafNTpHaN2YmBHIHfE2h4hONpYIwIED02MwIG2u4dSC4t%2BSaYVh8cRJvanet8VA%3D%3D
[Price] => stdClass Object
(
[Amount] => 986
[CurrencyCode] => USD
[FormattedPrice] => $9.86
)
[AmountSaved] => stdClass Object
(
[Amount] => 109
[CurrencyCode] => USD
[FormattedPrice] => $1.09
)
[PercentageSaved] => 10
[Availability] => Usually ships in 24 hours
[AvailabilityAttributes] => stdClass Object
(
[AvailabilityType] => now
[MinimumHours] => 0
[MaximumHours] => 0
)
[IsEligibleForSuperSaverShipping] => 1
)
)
)
[CustomerReviews] => stdClass Object
(
[IFrameURL] => http://www.amazon.com/reviews/iframe?akid=&alinkCode=sp1&asin=1933916958&atag=&exp=2013-08-08T23%3A01%3A28Z&v=2&sig=ooHZSabKAym%2BTAQVErbn36Ng95H65hAhTUgn9REzmE8%3D
[HasReviews] => 1
)
[EditorialReviews] => stdClass Object
(
[EditorialReview] => stdClass Object
(
[Source] => Product Description
[Content] => All Aiden wants to do is play with his friends, but his name starts with the wrong letter, he's wearing the wrong color, and is eating the wrong food. He's so confused that he's stumped! Lisa Rivard's I Am Stumped! teaches kids how to get along and that three is not a crowd.
[IsLinkSuppressed] =>
)
)
[BrowseNodes] => stdClass Object
(
[BrowseNode] => stdClass Object
(
[BrowseNodeId] => 3153
[Name] => Friendship
[Ancestors] => stdClass Object
(
[BrowseNode] => stdClass Object
(
[BrowseNodeId] => 7009087011
[Name] => Friendship, Social Skills & School Life
[Ancestors] => stdClass Object
(
[BrowseNode] => stdClass Object
(
[BrowseNodeId] => 1084192
[Name] => Growing Up & Facts of Life
[Ancestors] => stdClass Object
(
[BrowseNode] => stdClass Object
(
[BrowseNodeId] => 4
[Name] => Children's Books
[Ancestors] => stdClass Object
(
[BrowseNode] => stdClass Object
(
[BrowseNodeId] => 1000
[Name] => Subjects
[IsCategoryRoot] => 1
[Ancestors] => stdClass Object
(
[BrowseNode] => stdClass Object
(
[BrowseNodeId] => 283155
[Name] => Books
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
$title = $response['Items']->Item->ItemAttributes->Title;
$ISBN = $response['Items']->Item->ItemAttributes->ISBN;
Response is an Array not an object in the case above.
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
Hi I've asked this before but didn't get a correct answer. I am trying to get the Tracks to print from the stdObject. I've tried many possible answers but nothing worked apart from using:
var_dump("Track Title: " .
$response->Items->Item->Tracks->Disc->Track[0]->_);
But this only works if you know how many tracks there are for certain CD, I am calling 500 ASIN's at once. So basically I would like to parse the Tracks array into a String
[Items] => stdClass Object
(
[Request] => stdClass Object
(
[IsValid] => True
[ItemLookupRequest] => stdClass Object
(
[IdType] => ASIN
[ItemId] => B000002OGL
[ResponseGroup] => Tracks
[VariationPage] => All
)
)
[Item] => stdClass Object
(
[ASIN] => B000002OGL
[Tracks] => stdClass Object
(
[Disc] => stdClass Object
(
[Track] => Array
(
[0] => stdClass Object
(
[_] => Mustang Sally
[Number] => 1
)
[1] => stdClass Object
(
[_] => Take Me To The River
[Number] => 2
)
[2] => stdClass Object
(
[_] => Chain Of Fools
[Number] => 3
)
[3] => stdClass Object
(
[_] => The Dark End Of The Street
[Number] => 4
)
[4] => stdClass Object
(
[_] => Destination: Anywhere
[Number] => 5
)
[5] => stdClass Object
(
[_] => I Can't Stand The Rain
[Number] => 6
)
[6] => stdClass Object
(
[_] => Try A Little Tenderness
[Number] => 7
)
[7] => stdClass Object
(
[_] => Treat Me Right
[Number] => 8
)
[8] => stdClass Object
(
[_] => Do Right Woman Do Right Man
[Number] => 9
)
[9] => stdClass Object
(
[_] => Mr. Pitiful
[Number] => 10
)
[10] => stdClass Object
(
[_] => I Never Loved A Man
[Number] => 11
)
[11] => stdClass Object
(
[_] => In The Midnight Hour
[Number] => 12
)
[12] => stdClass Object
(
[_] => Bye Bye Baby
[Number] => 13
)
[13] => stdClass Object
(
[_] => Slip Away
[Number] => 14
)
)
[Number] => 1
)
)
)
)
)
you can do
foreach($response->Items->Item->Tracks->Disc->Track as $track){
echo "Track Title: ". $track->_;// or track title
}
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.
Been searching for a solution for my problem. Seams meny has the same q as me, but still haven't got a solution for my problem.
I have a stdClass Object that needs to be printed out in a foreach or somlike like that.
Here is a cut of the result i get with a "print_r($result)".
stdClass Object
(
[ServiceGroup] => Array
(
[0] => stdClass Object
(
[Service] => Array
(
[0] => stdClass Object
(
[_] => 3D-modulering
[count] => 71
)
[1] => stdClass Object
(
[_] => CAD
[count] => 81
)
[2] => stdClass Object
(
[_] => Databasutveckling
[count] => 118
)
[3] => stdClass Object
(
[_] => Datainmatare
[count] => 6
)
[4] => stdClass Object
(
[_] => Driftsteknik
[count] => 87
)
[5] => stdClass Object
(
[_] => IT-konsult
[count] => 39
)
[6] => stdClass Object
(
[_] => IT-tekniker
[count] => 223
)
[7] => stdClass Object
(
[_] => Mjuk- och hårdvarutestning
[count] => 150
)
[8] => stdClass Object
(
[_] => Nätverksteknik
[count] => 142
)
[9] => stdClass Object
(
[_] => Produkttestare
[count] => 171
)
[10] => stdClass Object
(
[_] => Programmerare
[count] => 146
)
[11] => stdClass Object
(
[_] => Projektledning
[count] => 156
)
[12] => stdClass Object
(
[_] => Serviceteknik
[count] => 157
)
[13] => stdClass Object
(
[_] => Support
[count] => 360
)
[14] => stdClass Object
(
[_] => Systemadministration
[count] => 145
)
[15] => stdClass Object
(
[_] => Systemutveckling
[count] => 110
)
[16] => stdClass Object
(
[_] => Webbdesign
[count] => 246
)
[17] => stdClass Object
(
[_] => Webbutveckling
[count] => 135
)
[18] => stdClass Object
(
[_] => webmaster
[count] => 103
)
)
[name] => Data/IT
)
[1] => stdClass Object
(
[Service] => Array
(
[0] => stdClass Object
(
[_] => Affärsanalys
[count] => 192
)
[1] => stdClass Object
(
[_] => Aktuarie
[count] => 20
)
I don't know exactly what you want, but can easily foreach through objects just like arrays. This example shows that.
foreach($result->ServiceGroup as $value){
foreach($value->Service as $obj){
echo $obj->_;
echo $obj->count;
}
echo $value->name;
}