How get rich content from an url (like Discord)? - embed

How can I get some page informations like title, description, thumbnail, etc. from an url like Discord?
I want do it in php or javascript.
Is it a protocol, an api or anything else?
Examples:

For PHP, use https://github.com/oscarotero/Embed
PHP library to get information from any web page (using oembed, opengraph, twitter-cards, scraping the html, etc). It's compatible with any web service (youtube, vimeo, flickr, instagram, etc) and has adapters to some sites like (archive.org, github, facebook, etc).

Related

How to embed image in HTML email template?

I have created an Email template using HTML and inline style from scratch. Now I need to add some images, at this point it's not possible to use url because it is not hosted. I tried using base64 encoding, it worked in Apple mail client, but the images are not rendering in Gmail. Is there any way to embed image in html supported by all email clients?
Host the Image publicly in Google Drive by sharing the link 'public on the Web' or 'anyone with the link'. Then use this link http://drive.google.com/uc?export=view&id=FILE_ID to get direct access to the image. You should replace the FILE_ID with actual id from Google Drive link.
Example :
Google Drive Link : https://drive.google.com/file/d/17iWczcf1T_D4kGRaQYBh6J2XOQI181u6/view?usp=sharing
Generated Link : http://drive.google.com/uc?export=view&id=17iWczcf1T_D4kGRaQYBh6J2XOQI181u6
Now you can use this link in your template.
Base64 has very limited support. Generally speaking it is not advised to use it. You can find information about base64 encoding support in this tutorial. It may help to decide if the supported client list is enough or not in your case.
Embedding images in the email is possible by sending them along with the email and reference the sent images with the img tag. A good starter reading for this method is Campaignmonitor’s “Embedding images revisited“ blog post.
The best solution is to host the images with a service provider, which is fast and maintained.
If you use Github, you can also serve images (or any other content) from the GH-Pages branch of a repository.

Embedd contact card

I'm making a small portfolio/application site in wordpress. Since I'm not much for social I would like to embed a contact card, like one of those you send over sms/mms/textmessage etc.
Is there some html syntax I could use or do I need to create a contact-card file?
Is there differences between platforms (windows phone, android and ios)?
EDIT: I have a link that makes the users device call me.
Dug up some standards for this, there seems to be a Contacts API that:
enables access to a user's address book service from inside a Web application
http://www.w3.org/TR/contacts-api/
If you'd like to use that, or other alternatives, i found more useful info at Add a contact to the mobile device Address book from an HTML webpage

Creating client video review pages in WordPress

We are looking for an easy way to share our work in progress videos with our clients - for feedback.
We are using WordPress.
We want to avoid email/ftp/youtube/vimeo etc... And simply have our clients access a link to our site that we give them.
Is there a way that I can get the following:
create a directory "client_0001" on our webserver
upload our client's videos to the directory
send the link to the server "http://mysite.com/client_0001" to our client
when the clients accesses the link they will be presented with our wordpress site, but not some post/page but rather a template of the site with html5video/mp4 players in the page for each video that we uploaded?
There's no real reason to do this using Wordpress. In fact, it would certainly be more work doing it in Wordpress. A decent way to do this would perhaps create a php page with your template/html5 player, and having this page parse a GET variable to display the video. That way you can send your clients links like http://mysite.com/video_preview.php?videofile=somevideofile.mp4
For example:
Directory Structure:
example.com/
previews/
video_preview.php
someVideo.mp4
Then in video_preview.php, you can parse a GET variable and display any page you want. Here's a rough example.
<?php $video = $_GET['videofile'] ?>
<html>
// The HTML you want to use for the template. All CSS/JS, etc, etc...make it look pretty. (or dow't)
// Then you'd call your video player, however you want to do that. Basically, you just dynamically choose the video file based on the URL your client clicks.
<player src=<?php echo $video ?>
</html>
I wish I had WordPress ten years ago when I was hand crafting all those client pages in Dreamweaver...
The only caveat right now is the file size that can be uploaded directly in WP. But this can be solved uploading via FTP to a custom folder and doing a video player Shortcode to render player+posterframe:
[vplay file="http://example.com/custom/video.mp4" poster="http://example.com/wp-content/uploads/picture.jpg"]
A custom page template, for example, with customized header and footer, that after page creation would have a URL like: http://example.com/clients/project-name/.
Password protected for the client's convenience, or some membership in the site for restricted content. Comments form enabled for internal communication. Image gallery if necessary. Among other goodies.
What's good about YouTube and Vimeo are the privacy options and doing the web-format rendering for you. In this WordPress Answers, Video tutorials in dashboard, I write about the options.

ensure embed code (iframe) is only used on customer web sites

I have a service and would like clients to be able to place this service on their website. I am looking at doing this by using an iframe. I will provide the code and they can just copy and paste the code to show the functionality. Each client will be discovered by the query string.
There is a concern that anyone can look at the source of the website, copy the iframe and add it to their own website therefore using the service and charging the original client. I obviously want to stop this.
Ideally, I would like to verify that the website that is using the iframe is linked to the client who registered to use the service. Is this possible at all? I know there are issues with cross domain security.
If it isn't possible, I guess I would need to create a widget instead.
For each client, have a whitelist of web sites that can embed the iframe. Then check the 'referer' header against that list whenever the page inside the iframe is loaded.
Or if http headers prove to be unreliable try using javascript, via parent.document.location.href

Needed: flexible yet secure user HTML embedding technique

Our software manages libraries, museums, archives etc. We'd like to let the users (namely the catalogers, not the visitors) add some embedded content such as Google maps, YouTube videos etc. We'd like the solution to be as flexible as possible, as each embedded content provider has it's own format. OTOH, we'd rather not allow the users to enter raw HTML, as this will impose both a XSS security risk and in case of erroneous HTML might screw up our surrounding web page.
I started looking into Google Maps today, and couldn't find a way to handle it. I don't want to let the users just copy the embedding HTML snippet into an item; I can't embed the link URL provided, as Google won't allow it; and I can't let the user specify the coordinates, as I don't want to use the Google Maps JS API (which means providing a built-in solution which we'll have to maintain).
The question in not specifically about Google Maps, but Google Maps is quite representative. I'd love to hear suggestions for a flexible-yet-secure HTML embedding technique.
Thanks,
Eran
Would Caja work for you?
Caja (pronounced "KA-ha") is "virtual
iframes": it allows you to put
untrusted third-party HTML and
JavaScript inline in your page and
still be secure. Caja
gives stricter control over what the code can do:
no redirects to phishing pages: the window object the untrusted code has is a fake one created by the containing page
no malware: all requests to URLs are proxied
no XSS: dynamic HTML sanitization
allows the untrusted code more power than is safe to give to code currently in iframes. Here are some possibilities:
floating frames ("info windows")
frames don't have to be rectangular
frames can communicate without the current awkward protocols
a reader could broadcast geographic information about the current article; a maps gadget jumps to the location, while a news gadget gets local stories and a weather gadget pulls up the weather
similarly for financial info or entertainment info
an extensible syntax highlighter could have plugins that can mark up text but not leak the contents to another website
can be a bit channel (can only send information) or a code channel (can send functions)
hosting page can control who talks to whom
markdown or other lightweight markup language for markup; custom macros for embedding allowed snippets (see like it is done on wordpress.com to embed youtube videos)