string uit object halen
wil iemand me misschien helpen?
Wat voor stdClass gaat het?
Code (php)
Output Hello
[script]object(stdClass)#9 (25) { ["created_at"]=> string(30) "Sun Aug 05 09:28:34 +0000 2018" ["id"]=> int(1026037234971987968) ["id_str"]=> string(19) "1026037234971987968" ["text"]=> string(2) "te" ["truncated"]=> bool(false) ["entities"]=> object(stdClass)#16 (5) { ["hashtags"]=> array(1) { [0]=> object(stdClass)#19 (2) { ["text"]=> string(7) "teacher" ["indices"]=> array(2) { [0]=> int(98) [1]=> int(106) } } } ["symbols"]=> array(0) { } ["user_mentions"]=> array(0) { } ["urls"]=> array(0) { } ["media"]=> array(1) { [0]=> object(stdClass)#15 (10) { ["id"]=> int(1026037232543531009) ["id_str"]=> string(19) "1026037232543531009" ["indices"]=> array(2) { [0]=> int(107) [1]=> int(130) } ["media_url"]=> string(46) "https://www." ["media_url_https"]=> string(47) "https://www." ["url"]=> string(23) "https://www." ["display_url"]=> string(26) "https://www." ["expanded_url"]=> string(67) "https://www." ["type"]=> string(5) "photo" ["sizes"]=> object(stdClass)#53 (4) { ["large"]=> object(stdClass)#18 (3) { ["w"]=> int(600) ["h"]=> int(399) ["resize"]=> string(3) "fit" } ["thumb"]=> object(stdClass)#48 (3) { ["w"]=> int(150) ["h"]=> int(150) ["resize"]=> string(4) "crop" } ["medium"]=> object(stdClass)#50 (3) { ["w"]=> int(600) ["h"]=> int(399) ["resize"]=> string(3) "fit" } ["small"]=> object(stdClass)#49 (3) { ["w"]=> int(600) ["h"]=> int(399) ["resize"]=> string(3) "fit" } } } } } ["extended_entities"]=> object(stdClass)#76 (1) { ["media"]=> array(1) { [0]=> object(stdClass)#47 (10) { ["id"]=> int(1026037232543531009) ["id_str"]=> string(19) "1026037232543531009" ["indices"]=> array(2) { [0]=> int(107) [1]=> int(130) } ["media_url"]=> string(46) "https://www." ["media_url_https"]=> string(47) "https://www." ["url"]=> string(23) "https://www." ["display_url"]=> string(26) "https://www." ["expanded_url"]=> string(67) "https://www." ["type"]=> string(5) "photo" ["sizes"]=> object(stdClass)#45 (4) { ["large"]=> object(stdClass)#46 (3) { ["w"]=> int(600) ["h"]=> int(399) ["resize"]=> string(3) "fit" } ["thumb"]=> object(stdClass)#73 (3) { ["w"]=> int(150) ["h"]=> int(150) ["resize"]=> string(4) "crop" } ["medium"]=> object(stdClass)#74 (3) { ["w"]=> int(600) ["h"]=> int(399) ["resize"]=> string(3) "fit" } ["small"]=> object(stdClass)#75 (3) { ["w"]=> int(600) ["h"]=> int(399) ["resize"]=> string(3) "fit" } } } } } ["source"]=> string(62) "TheTwitKid" ["in_reply_to_status_id"]=> NULL ["in_reply_to_status_id_str"]=> NULL ["in_reply_to_user_id"]=> NULL ["in_reply_to_user_id_str"]=> NULL ["in_reply_to_screen_name"]=> NULL ["user"]=> object(stdClass)#77 (41) { ["id"]=> int(1002495651014496256) ["id_str"]=> string(19) "1002495651014496256" ["name"]=> string(9) "Lulu Ward" ["screen_name"]=> string(12) "ddd" ["location"]=> string(19) "Manchester, England" ["description"]=> string(16) "????????????????" ["url"]=> string(23) "https://www." ["entities"]=> object(stdClass)#80 (2) { ["url"]=> object(stdClass)#79 (1) { ["urls"]=> array(1) { [0]=> object(stdClass)#78 (4) { ["url"]=> string(23) "https://www." ["expanded_url"]=> string(19) "https://www." ["display_url"]=> string(12) ".com" ["indices"]=> array(2) { [0]=> int(0) [1]=> int(23) } } } } ["description"]=> object(stdClass)#81 (1) { ["urls"]=> array(0) { } } } ["protected"]=> bool(false) ["followers_count"]=> int(0) ["friends_count"]=> int(1) ["listed_count"]=> int(0) ["created_at"]=> string(30) "Fri Jun 01 10:22:43 +0000 2018" ["favourites_count"]=> int(0) ["utc_offset"]=> NULL ["time_zone"]=> NULL ["geo_enabled"]=> bool(false) ["verified"]=> bool(false) ["statuses_count"]=> int(532) ["lang"]=> string(2) "en" ["contributors_enabled"]=> bool(false) ["is_translator"]=> bool(false) ["is_translation_enabled"]=> bool(false) ["profile_background_color"]=> string(6) "F5F8FA" ["profile_background_image_url"]=> NULL ["profile_background_image_url_https"]=> NULL ["profile_background_tile"]=> bool(false) ["profile_image_url"]=> string(75) "https://www." ["profile_image_url_https"]=> string(76) "https://www." ["profile_link_color"]=> string(6) "1DA1F2" ["profile_sidebar_border_color"]=> string(6) "C0DEED" ["profile_sidebar_fill_color"]=> string(6) "DDEEF6" ["profile_text_color"]=> string(6) "333333" ["profile_use_background_image"]=> bool(true) ["has_extended_profile"]=> bool(false) ["default_profile"]=> bool(true) ["default_profile_image"]=> bool(false) ["following"]=> bool(false) ["follow_request_sent"]=> bool(false) ["notifications"]=> bool(false) ["translator_type"]=> string(4) "none" } ["geo"]=> NULL ["coordinates"]=> NULL ["place"]=> NULL ["contributors"]=> NULL ["is_quote_status"]=> bool(false) ["retweet_count"]=> int(0) ["favorite_count"]=> int(0) ["favorited"]=> bool(false) ["retweeted"]=> bool(false) ["possibly_sensitive"]=> bool(false) ["lang"]=> string(2) "en"
}[/script]
ik probeer "expanded_url" eruit te halen
Toevoeging op 05/08/2018 11:35:07:
Nicky van boven op 05/08/2018 11:34:32:
Dit is het object die ik krijg als een response:
ik probeer "expanded_url" eruit te halen
Code (php)
1
2
2
object(stdClass)#9 (25) { ["created_at"]=> string(30) "Sun Aug 05 09:28:34 +0000 2018" ["id"]=> int(1026037234971987968) ["id_str"]=> string(19) "1026037234971987968" ["text"]=> string(2) "te" ["truncated"]=> bool(false) ["entities"]=> object(stdClass)#16 (5) { ["hashtags"]=> array(1) { [0]=> object(stdClass)#19 (2) { ["text"]=> string(7) "teacher" ["indices"]=> array(2) { [0]=> int(98) [1]=> int(106) } } } ["symbols"]=> array(0) { } ["user_mentions"]=> array(0) { } ["urls"]=> array(0) { } ["media"]=> array(1) { [0]=> object(stdClass)#15 (10) { ["id"]=> int(1026037232543531009) ["id_str"]=> string(19) "1026037232543531009" ["indices"]=> array(2) { [0]=> int(107) [1]=> int(130) } ["media_url"]=> string(46) "https://www." ["media_url_https"]=> string(47) "https://www." ["url"]=> string(23) "https://www." ["display_url"]=> string(26) "https://www." ["expanded_url"]=> string(67) "https://www." ["type"]=> string(5) "photo" ["sizes"]=> object(stdClass)#53 (4) { ["large"]=> object(stdClass)#18 (3) { ["w"]=> int(600) ["h"]=> int(399) ["resize"]=> string(3) "fit" } ["thumb"]=> object(stdClass)#48 (3) { ["w"]=> int(150) ["h"]=> int(150) ["resize"]=> string(4) "crop" } ["medium"]=> object(stdClass)#50 (3) { ["w"]=> int(600) ["h"]=> int(399) ["resize"]=> string(3) "fit" } ["small"]=> object(stdClass)#49 (3) { ["w"]=> int(600) ["h"]=> int(399) ["resize"]=> string(3) "fit" } } } } } ["extended_entities"]=> object(stdClass)#76 (1) { ["media"]=> array(1) { [0]=> object(stdClass)#47 (10) { ["id"]=> int(1026037232543531009) ["id_str"]=> string(19) "1026037232543531009" ["indices"]=> array(2) { [0]=> int(107) [1]=> int(130) } ["media_url"]=> string(46) "https://www." ["media_url_https"]=> string(47) "https://www." ["url"]=> string(23) "https://www." ["display_url"]=> string(26) "https://www." ["expanded_url"]=> string(67) "https://www." ["type"]=> string(5) "photo" ["sizes"]=> object(stdClass)#45 (4) { ["large"]=> object(stdClass)#46 (3) { ["w"]=> int(600) ["h"]=> int(399) ["resize"]=> string(3) "fit" } ["thumb"]=> object(stdClass)#73 (3) { ["w"]=> int(150) ["h"]=> int(150) ["resize"]=> string(4) "crop" } ["medium"]=> object(stdClass)#74 (3) { ["w"]=> int(600) ["h"]=> int(399) ["resize"]=> string(3) "fit" } ["small"]=> object(stdClass)#75 (3) { ["w"]=> int(600) ["h"]=> int(399) ["resize"]=> string(3) "fit" } } } } } ["source"]=> string(62) "TheTwitKid" ["in_reply_to_status_id"]=> NULL ["in_reply_to_status_id_str"]=> NULL ["in_reply_to_user_id"]=> NULL ["in_reply_to_user_id_str"]=> NULL ["in_reply_to_screen_name"]=> NULL ["user"]=> object(stdClass)#77 (41) { ["id"]=> int(1002495651014496256) ["id_str"]=> string(19) "1002495651014496256" ["name"]=> string(9) "Lulu Ward" ["screen_name"]=> string(12) "ddd" ["location"]=> string(19) "Manchester, England" ["description"]=> string(16) "????????????????" ["url"]=> string(23) "https://www." ["entities"]=> object(stdClass)#80 (2) { ["url"]=> object(stdClass)#79 (1) { ["urls"]=> array(1) { [0]=> object(stdClass)#78 (4) { ["url"]=> string(23) "https://www." ["expanded_url"]=> string(19) "https://www." ["display_url"]=> string(12) ".com" ["indices"]=> array(2) { [0]=> int(0) [1]=> int(23) } } } } ["description"]=> object(stdClass)#81 (1) { ["urls"]=> array(0) { } } } ["protected"]=> bool(false) ["followers_count"]=> int(0) ["friends_count"]=> int(1) ["listed_count"]=> int(0) ["created_at"]=> string(30) "Fri Jun 01 10:22:43 +0000 2018" ["favourites_count"]=> int(0) ["utc_offset"]=> NULL ["time_zone"]=> NULL ["geo_enabled"]=> bool(false) ["verified"]=> bool(false) ["statuses_count"]=> int(532) ["lang"]=> string(2) "en" ["contributors_enabled"]=> bool(false) ["is_translator"]=> bool(false) ["is_translation_enabled"]=> bool(false) ["profile_background_color"]=> string(6) "F5F8FA" ["profile_background_image_url"]=> NULL ["profile_background_image_url_https"]=> NULL ["profile_background_tile"]=> bool(false) ["profile_image_url"]=> string(75) "https://www." ["profile_image_url_https"]=> string(76) "https://www." ["profile_link_color"]=> string(6) "1DA1F2" ["profile_sidebar_border_color"]=> string(6) "C0DEED" ["profile_sidebar_fill_color"]=> string(6) "DDEEF6" ["profile_text_color"]=> string(6) "333333" ["profile_use_background_image"]=> bool(true) ["has_extended_profile"]=> bool(false) ["default_profile"]=> bool(true) ["default_profile_image"]=> bool(false) ["following"]=> bool(false) ["follow_request_sent"]=> bool(false) ["notifications"]=> bool(false) ["translator_type"]=> string(4) "none" } ["geo"]=> NULL ["coordinates"]=> NULL ["place"]=> NULL ["contributors"]=> NULL ["is_quote_status"]=> bool(false) ["retweet_count"]=> int(0) ["favorite_count"]=> int(0) ["favorited"]=> bool(false) ["retweeted"]=> bool(false) ["possibly_sensitive"]=> bool(false) ["lang"]=> string(2) "en"
}
}
ik probeer "expanded_url" eruit te halen
Toevoeging op 05/08/2018 11:45:07:
de object wordt in $result gezet
ik heb geprobeerd: $result->expanded_url $result[0]->expanded_url $result[1]->expanded_url
allen zonder resultaat
Hoe creëer je dit response-object of komt deze tot stand? Is dit het resultaat van een json_decode() operatie ofzo? Die heeft namelijk ook een parameter om van het resultaat een (genest) array te maken, wat misschien wat makkelijker is.
ik krijg deze respons als een object, ik weet verder niks eigenlijk, alleen die output.
Dus nogmaals, waar komt dit object (deze response) vandaan, en hoe komt deze tot stand.
Gewijzigd op 05/08/2018 19:34:56 door Thomas van den Heuvel
het zou ook helpen als je de response even tussen <pre> en </pre> laat uitspugen. dan wordt de tekst netjes geformatteerd. Een andere manier is om de bron van je pagina te bekijken en daar die response uit te kopiëren en hier weer te plakken.