Google adwords是很多外贸公司常用的推广方式之一,由于Google在搜索引擎领域的江湖地位,它的SEM还是很有效果的。不过很多新手在操作时,往往会出现这样那样的错误,流失的可都是白花花的银子啊。下面这10个错误是Goolgle adwords新手常犯的,要尽量避免。 1.使用Content Network (adsense) Content Network会带来可能欺诈性和非目标明确性的点击,所以开始时候要把Content…
May 15, 2015
php获取推特feed twitter timeline feed
申请 consumer_key, consumer_secret,oauth_access_token,oauth_access_token_secret
2. 下载项目:https://github.com/kmaida/twitter-timeline-php
下载:twitter-timeline-php-master
本人净化版:
require_once('_utils/twitter-api-oauth.php'); function formatTweet($tweet) { $linkified = '@(https?://([-w.]+[-w])+(:d+)?(/([w/_.#-]*(?S+)?[^.s])?)?)@'; $hashified = '/(^|[ns])#([^s"tnr<:]*)/is'; $mentionified = '/(^|[ns])@([^s"tnr<:]*)/is'; $prettyTweet = preg_replace( array( $linkified, $hashified, $mentionified ), array( '<a href="$1" class="link-tweet" target="_blank">$1</a>', '$1<a class="link-hashtag" href="https://twitter.com/search?q=%23$2&src=hash" target="_blank">#$2</a>', '$1<a class="link-mention" href="http://twitter.com/$2" target="_blank">@$2</a>' ), $tweet ); return $prettyTweet; } $settings = array( 'consumer_key' => "******", 'consumer_secret' => "******", 'oauth_access_token' => "******", 'oauth_access_token_secret' => "******" ); $tweetCount = 3; $twitterUsername = ''; $url = 'https://api.twitter.com/1.1/statuses/user_timeline.json'; $getfield = '?screen_name=' . $twitterUsername . '&count=' . $tweetCount; $twitter = new TwitterAPITimeline($settings); $json = $twitter->setGetfield($getfield)->buildOauth($url, $requestMethod)->performRequest(); $twitter_data = json_decode($json, true); // Create an array with the fetched JSON data //echo '<pre>'; print_r($twitter_data) ; $data = array(); foreach($twitter_data as $feed) { $photos = array(); $media = $feed['entities']['media']; if($media) foreach($media as $img) $photos[] = $img['media_url']; $data[] = array('tweet'=>formatTweet($feed['text']),'date'=>$feed['created_at'],'img'=>$photos); } echo '<pre>'; print_r($data);