Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/259.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Twitter使用PHP中的Twitter API获取最后一条推文_Php_Api_Twitter_Timeline - Fatal编程技术网

Twitter使用PHP中的Twitter API获取最后一条推文

Twitter使用PHP中的Twitter API获取最后一条推文,php,api,twitter,timeline,Php,Api,Twitter,Timeline,我怎样才能从twitterstatus/user\u timeline中只获取文本,并将其与返回true或false的php正则表达式相匹配 例如,我得到了这个 Array ( [0] => stdClass Object ( [place] => [truncated] => [user] => stdClass Object (

我怎样才能从twitter
status/user\u timeline
中只获取文本,并将其与返回
true
false
的php正则表达式相匹配

例如,我得到了这个

Array (
    [0] => stdClass Object
        (
            [place] => 
            [truncated] => 
            [user] => stdClass Object
                (
                    [default_profile_image] => 
                    [statuses_count] => 1944
                    [profile_background_tile] => 1
                    [protected] => 
                    [contributors_enabled] => 
                    [url] => http://www.mediawebsiteplus.com
                    [name] => Media Website Plus
                    [id_str] => 185200584
                    [is_translator] => 
                    [profile_link_color] => D02B55
                    [follow_request_sent] => 
                    [utc_offset] => 
                    [created_at] => Tue Aug 31 13:04:35 +0000 2010
                    [friends_count] => 1699
                    [profile_sidebar_border_color] => 829D5E
                    [following] => 1
                    [time_zone] => 
                    [profile_image_url] => http://a3.twimg.com/profile_images/1426659184/mwp_logo_normal.png
                    [description] => Media Website Plus adalah jasa pembuatan web, jasa pembuatan website, blog, web sekolah, toko online, dan aneka software murah dan berkualitas tinggi.
                    [profile_use_background_image] => 1
                    [favourites_count] => 0
                    [verified] => 
                    [profile_background_color] => 352726
                    [screen_name] => jasabuatwebsite
                    [listed_count] => 0
                    [profile_background_image_url] => http://a3.twimg.com/profile_background_images/283557264/mwp_logo.png
                    [id] => 185200584
                    [show_all_inline_media] => 
                    [geo_enabled] => 
                    [default_profile] => 
                    [notifications] => 
                    [profile_background_image_url_https] => https://si0.twimg.com/profile_background_images/283557264/mwp_logo.png
                    [profile_text_color] => 3E4415
                    [lang] => en
                    [profile_sidebar_fill_color] => 99CC33
                    [followers_count] => 210
                    [profile_image_url_https] => https://si0.twimg.com/profile_images/1426659184/mwp_logo_normal.png
                    [location] => indonesia
                )

            [id_str] => 91808775270432768
            [in_reply_to_status_id] => 
            [text] => Govt Will Not Increase Subsidized Fuel Prices: “In the remaining time of the year there may be an option to rais... http://bit.ly/qJqn9H
            [created_at] => Fri Jul 15 09:58:12 +0000 2011
            [geo] => 
            [favorited] => 
            [in_reply_to_status_id_str] => 
            [coordinates] => 
            [id] => 9.18087752704E+16
            [in_reply_to_screen_name] => 
            [source] => <a href="http://twitterfeed.com" rel="nofollow">twitterfeed</a>
            [in_reply_to_user_id_str] => 
            [in_reply_to_user_id] => 
            [contributors] => 
            [retweeted] => 
            [retweet_count] => 0
        )
数组(
[0]=>stdClass对象
(
[地点]=>
[截断]=>
[用户]=>stdClass对象
(
[默认配置文件\u图像]=>
[状态计数]=>1944
[profile\u background\u tile]=>1
[受保护]=>
[已启用贡献者]=>
[网址]=>http://www.mediawebsiteplus.com
[名称]=>媒体网站升级版
[id_str]=>185200584
[是翻译]=>
[配置文件链接颜色]=>D02B55
[按照请求发送]=>
[utc_偏移]=>
[创建时间]=>2010年8月31日星期二13:04:35+0000
[好友数]=>1699
[配置文件\侧边栏\边框\颜色]=>829D5E
[以下]=>1
[时区]=>
[profile\u image\u url]=>http://a3.twimg.com/profile_images/1426659184/mwp_logo_normal.png
[说明]=>媒体网站加上adalah jasa pembuatan网站、jasa pembuatan网站、博客、sekolah网站、toko在线、dan aneka软件murah和Berkalitas tinggi。
[配置文件\u使用\u背景\u图像]=>1
[收藏夹\u计数]=>0
[已验证]=>
[配置文件\u背景\u颜色]=>352726
[屏幕名称]=>JasaBuatWeb站点
[列出的\u计数]=>0
[profile\u background\u image\u url]=>http://a3.twimg.com/profile_background_images/283557264/mwp_logo.png
[id]=>185200584
[显示所有内嵌媒体]=>
[地理位置已启用]=>
[默认配置文件]=>
[通知]=>
[profile\u background\u image\u url\u https]=>https://si0.twimg.com/profile_background_images/283557264/mwp_logo.png
[配置文件文本颜色]=>3E4415
[lang]=>en
[profile_sidebar_fill_color]=>99CC33
[followers_count]=>210
[profile\u image\u url\u https]=>https://si0.twimg.com/profile_images/1426659184/mwp_logo_normal.png
[位置]=>印度尼西亚
)
[id_str]=>91808775270432768
[在对状态的回复中]=>
[文本]=>政府不会提高补贴燃油价格:在今年剩余时间内,可能会有提高燃油价格的选择。。。http://bit.ly/qJqn9H
[创建时间]=>2011年7月15日星期五09:58:12+0000
[地理]=>
[favorited]=>
[在对状态的回复中\u id\u str]=>
[坐标]=>
[id]=>9.18087752704E+16
[在屏幕上回复到屏幕名称]=>
[来源]=>
[在答复用户id时]=>
[在答复用户id时]=>
[贡献者]=>
[转发]=>
[转发次数]=>0
)
)我解决了这个问题:

$sep_status = $home_timeline[0]->text;
if (eregi($status, $sep_status)){
    echo "true !";
} else {
    echo "false !";
}

如果您解决了自己的问题,请将您的解决方案作为答案发布并接受,而不是将其编辑到您的问题中。谢谢