what IS the og:url metatag? - ios

I am building an iOS app that is supposed to use openGraph objects for users.
As I see it, I need to :
1. create object pages for each of these objects that contains all the metatags that facebook is generating for your created objects in Get Code.
2. Use the iOS app to generate opengraph requests that involve these objects through a single page. ie. a PHP file that uses parameters you might send to it, that would generate links to images and some titles etc... (am I right?)
The thing is that the PHP file on step 2 is supposed to be the object itself, and my object needs a og:url which is either interpreted as a type:wesite, which is wrong because my type is set to my own custom type! or it just throws an error saying that the og:url is not valid.
I can see that facebook is scraping whatever I give it in the og:url, so basically why is this needed in the first place if all metatags are ignored?

You seem to have this correct, basically, to publish an action against an object using the Open Graph APIs, there needs to be an object URL which, when accessed, does one of the following
Contains the complete set of metadata needed to describe whatever type of object you're created and serves this to Facebook's crawler
Contains an og:url meta tag, a <link ref="canonical tag or a HTTP 301 redirect pointing to a URL which does 1)
Having a PHP script which takes input parameters and returns metadata based on those is a common approach, the biggest thing to watch out for is that your og:url tag matches the input parameters, so Facebook's crawler doesn't make a new request out to that URL instead of the one it asked for originally

og:url means: Open Graph Uniform resource locator.
https://developers.facebook.com/docs/opengraph/tutorial/

Related

How to link to a page part without a URL fragment?

I need to add links to a web application that point to specific parts of another page in the same application.
Normally, it is done using a URL with a fragment part (an element ID after the '#' character).
Unfortunately, the application has already used the fragment part of URLs to store another data - a kind of session ID.
I wonder if there is any other, reasonable way of pointing to a web page part, different than the URL fragments.

Microsoft Graph OneDrive webUrl property not consistent

The webUrl property of an Onedrive item differs on if the file can be opened Online or not.
As an example when I call /v1.0/me/drive/root/children I get items with
https://domain-my.sharepoint.com/personal/user/_layouts/WopiFrame.aspx?source={{id}}&file={{filename}}
https://domain-my.sharepoint.com/personal/Documents/Folder/filename.txt
Why not using a consistent url here, as the Online Apps will also work with the second Url?
The second url can also be used by the client apps to open the document while the first url can't.
It's also hard to construct the second version of the link from the other item properties while the first link can be easily constructed.
The purpose of the webUrl is to provide a URL that displays the resource in the browser. In the cases where a specialized experience can be provided (such as coediting office files in the web app) we'll return URLs specific to those scenarios, otherwise we'll return a generic URL and expect the browser to "do the right thing".
It is possible to always get URLs of the form of 2. by selecting the webDavUrl property when requesting the item.
See this documentation for descriptions of these fields.

Forcing a page to POST

This may be a very unusual question, but basically there's a page on another domain (that I can view, but can't edit/change) that has a button. When that button is clicked it generates some unique keys.
I need to pull those unique keys with my web service (using ASP .NET MVC3) I can get the initial HTML of the page, but how can I force the page to "click" the button so that I can get the values after the POST?
Normally, I'd reuse the code to generate keys myself, but I don't have access to the logic.
I hope this makes sense.
Use e.g. firebug to see what POST parameters are sent with form and then make the same POST from your code.
For this you can use WebRequest or WebClient.
See this SO questions that will help you how to do it:
HTTP request with post
Send POST request in C# like a web page does?
How to simulate browser HTTP POST request and capture result in C#
Then just parse the response with technology of your choice (I would use regular expressions - Regex, or LinqToXml if the response is well formed XML).
Note: Keep in mind that your code will be dependent on some service you are not maintaining. So you can get in problems when the service is unavailable, discontinued or if the format of POSTed form or response will be changed.
This really depends on the technology on the targeted site.
If the page is a simple HTML form then you can easily send a POST. You will need to send the expected data to the POST. Then you can parse the data.
If its not so straight forward you will need to look into ways to automate the click. Check Selenium. Also you might need to employ scrapping if the results page is a mess.

How do facebook and my iOS communicate

I'd like to use iOS to post on my users's facebook walls/tickers/news feeds. I learned that opengraph can be very specific about the actions users take inside my app, and I'd like to integrate them into my project.
I think I realize now I am going to need my own server running for opengraph actions to work ,right? or is this not a must? from what I understand, the server supplies the basic data to facebook for the post, like image, main text, secondary text etc...
Is my server needed just to supply the facebook posts' data? Is my server called everytime a facebook page is loaded with my app's contents? Or is it done only once, and facebook is copying the posts' content into facebook's servers?
What happens if my servers is not responsive etc?
The short answer: yes, you probably need a server.
The longer answer:
The facebook documentation on Open Graph is much better than what I can fit here. If you have not already, check out this page and its links: https://developers.facebook.com/docs/opengraph/.
A published action on facebook is a tuple { user, action, object }. The types of actions and objects are defined in the facebook developer application (developers.facebook.com/apps).
The content of the post is generated by your iOS client. The post has data that references the action by name and the object by its URL.
The individual objects that your app defines are typically represented by pages on your web server. These pages are scraped by Facebook to extract metadata that defines the object, including images and text. I do not know of safe assumptions you can make about when the object's page will be scraped.
It is possible to create sample objects when you are editing your object types (developers.facebook.com/apps, create or edit one of your apps, "Edit Open Graph", "Add Sample Data"). However, because these are intended for experimentation, they are fairly limited in what you can do with them.

Hide website filenames in URL

I would like to hide the webpage name in the url and only display either the domain name or parts of it.
For example:
I have a website called "MyWebSite". The url is: localhost:8080/mywebsite/welcome.xhtml. I would like to display only the "localhost:8080/mywebsite/".
However if the page is at, for example, localhost:8080/mywebsite/restricted/restricted.xhtml then I would like to display localhost:8080/mywebsite/restricted/.
I believe this can be done in the web.xml file.
I believe that you want URL rewriting. Check out this link: http://en.wikipedia.org/wiki/Rewrite_engine - there are many approaches to URL rewriting, you need to decide what is appropriate for you. Some of the approaches do make use of the web.config file.
You can do this in several ways. The one I see most is to have a "front door" called a rewrite engine that parses the URL dynamically to internally redirect the request, without exposing details about how that might happen as you would see if you used simple query strings, etc. This allows the URL you specify to be digested into a request for a master page with specific content, instead of just looking up a physical page at that location to serve.
The StackExchange sites do this so that you can link to a question in a semi-permanent fashion (and thus can use search engines with crawlers that log these URLs) without them having to have a real page in the file system for every question that's ever been asked (we're up to 9,387,788 questions as of this one).

Resources