export phpbb forum post to blogger or some other blog - phpbb

There is this forum. I want to to be able to select a certain forum post and convert it to a blogger post . Is this possible ? If so how do I get started ?
Thanks

This is certainly possible but no Mod currently exists for this so you would have to custom code to create a Mod in PHPBB from the Posting Page to push posts to Blogger. You can use the following function of the Blogger PHP API to create a Blogger Post:
function createPublishedPost($title='Hello, world!', $content='I am blogging on the internet.')
{
$uri = 'http://www.blogger.com/feeds/' . $blogID . '/posts/default';
$entry = $gdClient->newEntry();
$entry->title = $gdClient->newTitle($title);
$entry->content = $gdClient->newContent($content);
$entry->content->setType('text');
$createdPost = $gdClient->insertEntry($entry, $uri);
$idText = split('-', $createdPost->id->text);
$newPostID = $idText[2];
return $newPostID;
}
More information about the Blogger API can be found here:
http://code.google.com/apis/blogger/docs/1.0/developers_guide_php.html
If you don't have the necessary skills to create a PHPBB Mod you can request a Mod by posting a request on the following PHPBB Forum:
http://www.phpbb.com/community/viewforum.php?f=72
Pete

Related

How to get all url's ( not just titles ) in a wikipedia article using mediawiki api?

I am using the wikimedia api to retrieve all possible URL's from a wikipedia article ,'https://en.wikipedia.org/w/api.php?action=query&prop=links&redirects&pllimit=500&format=json' , but it is only giving a list of link titles , for example , Artificial Intelligence , wikipedia page has a link titled " delivery networks," , but the actual URL is "https://en.wikipedia.org/wiki/Content_delivery_network" , which is what I want
Use a generator:
action=query&
format=jsonfm&
titles=Estelle_Morris&
redirects&
generator=links&
gpllimit=500&
prop=info&
inprop=url
See API docs on generators and the info module.
I have replaced most of my previous answer, including the code, to use the information provided in Tgr's answer, in case someone else would like sample Python code. This code is heavily based on code from Mediawiki for so-called 'raw continuations'.
I have deliberately limited the number of links requested per invocation to five so that one more parameter possibility could be demonstrated.
import requests
def query(request):
request['action'] = 'query'
request['format'] = 'json'
request['prop'] = 'info'
request['generator'] = 'links'
request['inprop'] = 'url'
previousContinue = {}
while True:
req = request.copy()
req.update(previousContinue)
result = requests.get('http://en.wikipedia.org/w/api.php', params=req).json()
if 'error' in result:
raise Error(result['error'])
if 'warnings' in result:
print(result['warnings'])
if 'query' in result:
yield result['query']
if 'continue' in result:
previousContinue = {'gplcontinue': result['continue']['gplcontinue']}
else:
break
count = 0
for result in query({'titles': 'Estelle Morris', 'gpllimit': '5'}):
for url in [_['fullurl'] for _ in list(result.values())[0].values()]:
print (url)
I mentioned in my first answer that, if the OP wanted to do something similar with artificial intelligence then he should begin with 'Artificial intelligence' — noting the capitalisation. Otherwise the search would start with a disambiguation page and all of the complications that could arise with those.

What is the best way to call channel9 api for getting video?

Lets say that i have URL to channel9 movie;
Ex: https://channel9.msdn.com/Series/Office-365-Tips--Tricks/01-Wprowadzenie
And I want to display this movie on my site, and display some information for it ex. duration.
All what I know already is that, I can get list of movies by calling
https://channel9.msdn.com/odata/Entries and skipping it +25 for showing next 25 results.
My implementation right now is something like:
Get first 25 elements from api
Iterate throught them
compare my url with elementFromApi[i].url
Its working but I don't like this solution, it is non elegant and slow as hell. I have no knowledge about the api so i dunno know how to refactor this^.
Maybe someone of You can help me.
PS. I need information from api, embed iframe with given url is not the solution here :)
PS2. Sorry for my english.
I got this requirement through my client and I ended up doing it using RSS! In your use case the URL is https://channel9.msdn.com/Series/Office-365-Tips--Tricks/01-Wprowadzenie - Simply we can read the rss by using the link https://s.ch9.ms/Series/Office-365-Tips--Tricks/rss/mp4 - In PowerShell we can explore the content with the below piece of code
$Sessions = Invoke-Restmethod -Uri 'https://s.ch9.ms/Series/Office-365-Tips--Tricks/rss/mp4' -UseDefaultCredentials
foreach($Session in $Sessions) {
$Duration = [timespan]::FromSeconds($Session.duration)
[pscustomobject]#{
Title = $Session.title
Duration = ("{0:0}:{1:00}:{2:00}" -f ($Duration.Hours , $Duration.Minutes , $Duration.Seconds))
Creator = $Session.creator
"URl(MP3)" = $Session.group.content.url[0]
"URl(MP4)" = $Session.group.content.url[1]
"URl(webm)" = $Session.group.content.url[2]
"URl(MP4High)" = $Session.group.content.url[3]
}
}
Note: Code needs to be improvised!
The same can be achieved using C# - But I am not a certified developer - So , I used PowerShell to meet client requirement.

How to get crawl stats FROM webmaster tools api

I want to get this graph datas :
I can't add an image here : graph.png I don't have the reputation 10.
So I want to get for each day the 3 values (Pages crawled per day, kilobytes downloaded per day, time spent downloading a page)
the idea is to get an array like this :
$datas['2015-11-20']['pages_crawled'] = 125;
$datas['2015-11-20']['kilobytes'] = 1452;
$datas['2015-11-20']['time_spent'] = 1023;
$datas['2015-11-21']['pages_crawled'] = 146;
$datas['2015-11-21']['kilobytes'] = 2410;
$datas['2015-11-21']['time_spent'] = 1563;
$datas['2015-11-22']['pages_crawled'] = 102;
$datas['2015-11-22']['kilobytes'] = 1560;
$datas['2015-11-22']['time_spent'] = 1400;
Something like this.
thanks specially to #alex for his greathfull Help.
Unfortunately you can't get this Crawl Stats via API.
The only supported methods are webmasters.urlcrawlerrorscounts.query, webmasters.urlcrawlerrorssamples.list, webmasters.urlcrawlerrorssamples.get, webmasters.urlcrawlerrorssamples.markAsFixed ( https://developers.google.com/apis-explorer/#p/webmasters/v3/ )
So you can get information about crawl errors, but not general crawl stats.
The crawl errors you can retrieve with this API call :
https://www.googleapis.com/webmasters/v3/sites/https%3A%2F%2Fwww.mywebsite.com/urlCrawlErrorsCounts/query?latestCountsOnly=true&fields=countPerTypes&key={YOUR_API_KEY}
But the crawl statistics are not exposed through API.

Post to my Facebook page (not user status )

I have now spend the weekend trying to figure out how to post a status update to a facebook page (not user ) with out any luck (Yes my wife is angry Wink | ;-) .
Looks like on the net there is no working example.
This is what I got so far is:
Dim fb = New FacebookClient()
fb.AppSecret = app_secret
fb.AppId = app_id
Dim result = fb.[Get]("oauth/access_token", New With {Key .client_id = app_id, Key .client_secret = app_secret, Key .grant_type = scope, Key .redirect_uri = Url})
fb.AccessToken = result.access_token
fb.Post("/me/feed", New With {Key .message = "My first post"})
But still no luck , anybody how can point me in the right direction , and please also include info how to get the access token.
Ps. Im using the facebook-csharp-sdk
Thanks alot
Please refer to this document right here: "https://developers.facebook.com/docs/wordpress/" which explains the Wordpress plugin and how to use your app to post to your own Facebook page (this is very similar to your case). Hope this helps!

joomla: use API inside an article

I am using the Sourcerer plugin to use PHP code inside my articles. I would like to use the Joomla API/framework inside my article to dynamically set the HTML meta tags and other stuff. I found the setHeadData method that should allow me do that but I have simply no idea as to how calling it.
[Q] Can someone give me 1 example or point me to a tutorial that would help me get started on using that joomla API/framework please?
Answer
Based on the numerous feedbacks all pointing in the same direction, using a content plugin to modify the head data is properly better than doing this via an article. If like me you want to do this in an article here is what I did:
(1) I used the snippet provided by ezpresso to set the head data inside my article.
(2) I modified the libraries/joomla/document/html/renderer/head.php file to change the way the head data was set there.
For instance you can set the title meta tag at step (1) and then at step (2) replace the following line:
$strHtml .= $tab.'<title>'.htmlspecialchars($document->getTitle()).'</title>'.$lnEnd;
with this one:
$strHtml .= $tab.'<title>'.htmlspecialchars($document['metaTags']['standard']['title']).'</title>'.$lnEnd;
You might also want to look into libraries/joomla/document/html/renderer/head.php to do some more cleanup in the head, like getting rid of the generator meta tag that Joomla inserts.
Here is the source code of the method you are referring to:
/**
* Set the html document head data
*
* #access public
* #param array $data The document head data in array form
*/
function setHeadData($data)
{
$this->title = (isset($data['title'])) ? $data['title'] : $this->title;
$this->description = (isset($data['description'])) ? $data['description'] : $this->description;
$this->link = (isset($data['link'])) ? $data['link'] : $this->link;
$this->_metaTags = (isset($data['metaTags'])) ? $data['metaTags'] : $this->_metaTags;
$this->_links = (isset($data['links'])) ? $data['links'] : $this->_links;
$this->_styleSheets = (isset($data['styleSheets'])) ? $data['styleSheets'] : $this->_styleSheets;
$this->_style = (isset($data['style'])) ? $data['style'] : $this->_style;
$this->_scripts = (isset($data['scripts'])) ? $data['scripts'] : $this->_scripts;
$this->_script = (isset($data['script'])) ? $data['script'] : $this->_script;
$this->_custom = (isset($data['custom'])) ? $data['custom'] : $this->_custom;
}
It is implemented in a JDocumentHtml class, which is located in a libraries/joomla/document/html/html.php directory.
Below is the links to some of the examples of how to use it:
setHeadData difference between j1.5 and j1.6
Remove Mootools From Joomla Header
I guess you may call the setHeadData method like this:
$doc =& JFactory::getDocument();
$options = $doc->getHeadData();
$options['metaTags'] = array("tag1", "tag2", "tag3"); // you may change the meta tags here
$doc->setHeadData($options);
Putting PHP in the article is not a very good way to accomplish what you are trying to do. Joomla frameworks has an order of operation that determines when various functions and plugins run. Due to the order of operation, there are numerous functions that will happen after an article is rendered, probably negating any changes you make from within the article. You would be better off either using an extension to handle titles and meta tags rather than trying to do it inside the article.