How to set content type to html on Google Calendar api? - zend-framework

So reading the google calendar api (php) documentation it states:
"...content, set using setContent, provides additional information about the event which appears when the event details are requested from within Google Calendar. Optionally, the description's mime-type is set using setType to specify HTML instead of plain text. "
I've been trying to figure this out for a really long time but i have no idea how to go about setting the content to html instead of plan text. I tried using the setType method, on Zend_Gdata_Calendar object, but it said the method doesn't exist. Any ideas?

In the API there is a section that talks about "Creating web content events." That shows an example of setting the type, which is just a MIME type. For HTML, you can set the type as "text/html" and then provide the link to the HTML.
Data API Developer's Guide: PHP
From reading it, I believe this will create an iFrame that shows your content. I've been playing around with this a lot in .NET and it seems to work. I hope this helps you.

Related

Schema.org in JSON LD format recognized by Google, but Facebook pixel helper does not detect it

I have added schema.org tags in JSON LD format using <script>, when I test my page using Google structured data testing tool, I can see all my tags.
But, when I installed Facebook pixel helper chrome extension to test my page, schema.org tags were shown as blank. Not sure why Facebook pixel helper is not able to detect it.
Would appreciate any help.
I found that Facebook Pixel is more strict in its parsing of structured data. Blank line feeds in fields will cause it to throw up warnings. This occurred to me when I had line feeds in an address. The address was correctly interpreted by google, but Facebook Pixel put up warnings in the console.
Adding the following code resolved it in my case:
$address = preg_replace( "/\r|\n/", " ", $address );
Of course, as pointed out here JSON doesn't support real line-breaks.
Late for the party, but still for people who come here. FB pixel now supports JSON-LD: https://www.facebook.com/business/help/1175004275966513
For me, there was an error in multiple spaces (as I understand it). Therefore, I use this code:
$description = preg_replace("#\r|\n|(\s+)#iu", " ", $description);
The JSON extension also adds Schema markup in JSON-LD format for all other webpages, which Google prefers. “Facebook pixel” does not read Schema meta tags or JSON-LD (Pinterest reads Schema meta tags, but not JSON-LD – yet).
It sounds like you may be a bit confused – Facebook does not read Schema markup – Facebook reads Open Graph meta tags. You can find details of the standard here: http://ogp.me/.
FYI https://www.withintheflow.com/facebook-pixel-helper/
You might happen to have fbq('set', 'autoConfig', 'false') in the init call.
The Facebook pixel will send metadata to your pixel setup but in the init code if you have autoConfig set to false, Facebook Pixel will not send this additional information.

OneNote API - Get Raw XML

Using OneNote's Onetastic I've been able to inspect the raw XML structure of the notebooks. The REST API returns the page information as HTML, but is limited (no support for ink, shapes, OCR, etc.)
Is there some way to get the raw XML of the page? Perhaps from the OneDrive API?
Thanks in advance!
Unfortunately, there isn't. You can only get HTML.
I do encourage you to go into our uservoice site and create requests for whetever type of content we don't support:
https://onenote.uservoice.com/forums/245490-onenote-developer-apis
For example, there is one for ink.
https://onenote.uservoice.com/forums/245490-onenote-developer-apis/suggestions/5657688-ink-support-in-the-api

urlread pound sign (#) doesn't work

Trying to read in the pricing lists under pricing information tab:
urlread( ' http://www.cefconnect.com/Details/Summary.aspx?Ticker=KYE#pricing ' )
But in url '#pricing' doesn't help.
Any suggestions?
As already pointed out by Darin, it's no use adding #pricing to the URL. The web page uses client-side techniques to switch between tabs; not something that can be used by urlread.
Summary.aspx always returns all tabs together as one big page. CSS and JavaScript make it look like a collection of tabs, when opened in a web browser.
Use the developer toolbar of your web browser to inspect the web page. For example in Google Chrome, just right-click on the section you are interested in, and select 'inspect element'.
I don't know what you are going to do with the result of urlread, but you'll probably have to do some parsing to distill the information you need from the HTML clutter.
Please note Summary.aspx launches additional HTTP requests to retrieve additional data. Use the 'Network' tab of Chrome's developer toolbar to analyze that behavior. For example, the following request is made when you click 'GO' after adjusting the pricing history filter criteria.
http://www.cefconnect.com/Resources/TableData/?Type=PricingHistory&Cusip=48660P104&param0=1M&param1=06/06/2014
At first, this seems to complicate the whole matter, but it may actually be a great opportunity. You can call urlread with the URL above, and get some data in JSON format, which is far less cluttered than HTML. Adjust the parameters to get different data. I'm not sure what 48660P104 is; it might be an internal representation of KYE. You may want to use an initial HTTP request to Summary.aspx to retrieve that code; you'll notice the webpage is littered with URLs containing the same parameter Cusip.
The # character has a special meaning in an url. It represents the fragment identifier and the value following it is never sent to the server. Only client side javascript can access it. You will need to url encode the value if you want to send it to the server:
urlread( ' http://www.cefconnect.com/Details/Summary.aspx?Ticker=KYE%23pricing ' )
This also stands true for other special characters. You need to properly encode them.

Format of External Links on Facebook

I have seen when you visit a profile on FB and click on link provided in
Contact Information --> Website
Facebook first take you to url format mentioned below
http://www.facebook.com/l.php?u=http%3A%2F%2Fwww.nwaonfire.com%2F&h=BAQByDCFo
and then takes you to the site .
My question is why facebook does so, Iam asking because there is a place in my application where iam allowing users to enter website urls.
...and the reason for facebook using the mentioned link instead of linking directly to http://www.nwaonfire.com is that facebook is evil.
They want to know which links are popular, where their users are going and where the link came from.
I also see a format as http://www.facebook.com/l/BAQByDCFo/www.nwaonfire.com where the BAQByDCFo is a hash value.
URL encoding is done so that a second URL can be placed within the first's query string without breaking the original URL. For example, implying directory structure by using the "/" character or breaking out of name value pair by using "&". If you're going to be embedding a URL as a query string parameter, you must encode it first. How you do this will differ depending on the language you're working with but most web based frameworks have a native or library based function to easily do this.

How does facebook's Share a link feature work?

I'm trying to implement a feature like that where a user inputs a url and when displaying that url I want to have a custom display (an embed object if it's a video from youtube, a thumbnail if it's an image link, title and excerpt of body if it's a normal link).
How can such a feature be realized?
There is a new idea called oEmbed that a few sites support (Flickr, Vimeo and a few others) that addresses this problem. oEmbed site
Otherwise, just check the site against a list of ones you pick and then pull out the relevant bits to construct an embed link.
I liked the idea of oEmbed a lot but unfortunately it doesn't has that much adoption yet.
oohEmbed tries to solve this issue by building oEmbed for many websites.
For the feature to work, it needs the server's interaction where I believe the following scenario is how it works
Assume that we have the site humanzz.com and that it provides such feature
A user enters a url on the humanzz.com's webpage and presses a button like facebooks' preview button
An AJAX call is made to a dedicated page on humanzz.com
humanzz.com does calls the remote website and gets its data
The AJAX call now returns the page's data (oEmbed JSON object)
This involves so much server's overhead.
I really wanted to do it using JavaScript as the server's role was only to bypass "Same Origin Policy"'s restrictions.
oohEmbed allows bypassing the server's step by specifying a callback parameter to oohEmbed so that the JSON object returned is passed to a callback function on your page.
An example illustrating this is as follows
Add a script tag dynamically to your page
< script type="text/javascript" src="http://oohembed.com/oohembed/?url=http%3A//www.amazon.com/Myths-Innovation-Scott-Berkun/dp/0596527055/&callback=myCallBack">< /script>
This would result in executing myCallback(oEmbedJSONObject) which is great.
The problem with that solution is you still have to have a fallback for websites that don't have oEmbed representations.
For the embedded things, I have been using auto_html ( https://github.com/dejan/auto_html) with great success (vimeo, youtube, images) and even added soundcloud myself. But I am still looking for a "thumbnail" generation with an image and text facebook-like.
I guess you have to construct it by yourself by manually parsing the kind of URL you get.
If it is an image url, well then you just have to rescale it and in case the user clicks on it, then handle that by opening the original one somehow.
If it is a link to some youtube video, then you have to take a look at how the embedding of Youtube videos works. You can just copy the code that is provided by Youtube itself, and then exchange the parts with the URL to the video with the URL you got from your user.
I did never implement something like that, but I assume it should work somehow like this.