reading only text from Html using PHP - php

i read the meta tags from a PHP script that read the url convert it to html and then read the tags and title .................for this no problem but the problem is i wants to read only the text from html...............
for Example when you put a link on facebook you can see that i read's your Title and some text from your webpage url.
like the google does while search the web page.
i wants to know that how can i write a script that work like a facebook book mark.........

Use DOMDocument::loadHTML

Related

How I can post link in html to youtube comment

I am trying to post a html link on YouTube comment but Some how I could not do that thing. It always shows html codes on the comment section. I am using php function
$comment = 'Shawon';
$commen = html_entity_decode($comment);
It shows the output as the html codes in $comment. Or tell me which content-type will work for this.
Could you please help me?
It seem it is not possible: https://developers.google.com/youtube/2.0/developers_guide_protocol_comments
A comment is a text response to a video. Logged-in users can add comments to a video but cannot modify or delete those comments. In addition, please note that YouTube will convert any HTML markup that appears in a comment into plain text. Typically, a user would add a comment to a video after watching that video.

Is there a PHP solution for copying a text from Word doc and paste in a text-area and still get URLs

I want to create a some kind of a <textarea>/textbox on my page, that when you copy from a word document a paragraph with links, and when I submit a form (PHP) - it gets the text as an exactly how the doc looks like.
The only solution I have found for this is using something like TinyMCE
Is there a better PHPish solution for this? Or other HTML text-area tag I don't know of in HTML that does that?
yes,you can do it easily using TinyMCE

How to embed twitter tweets .. How to catch images from tweets URLs and display the actual images?

I was wondering what kind of method I could use to directly embed videos or pictures contained in twitter tweets directly ... For example .. below is a tweet from OBAMA
President Obama: "Right now, we have a real chance to reduce gun violence in America." http://t.co/tmCoUsPyyB #TimeToAct
The link that starts with htttp:// could be a picture .. How can I actually program it so that tweets are directly displayed with the images from the urls ? I know PHP and I used the twitter API before , but I dont know how I could easily achieve that . Any help would be appreciated
The first step would to to pull the URLs of of the block of text, there is another question that points you how to solve this: Extract URLs from text in PHP
You can then use Embedly or a service like it to pull the metadata associated with that url. Here is an example of the meta data that Embedly will return: http://embed.ly/docs/explore/oembed?url=http%3A%2F%2Ft.co%2FtmCoUsPyyB
The html attribute is what you want to render on your page.
We also have a PHP library you can use as well.
Hope that helps!

Retrieve Title,Description and thumbnail of a url in php/Javascript/jqueryurl

As we post any url on facebook, it shows its meta-data(title, decription and thumbnail image), How can we achieve same thing in php or scripting language(javascript/jquery).
I believe, Facebook simply parses the html code of the Website behind the link and looks for <img /> tags. You can then choose any of the found images as picture for your link.
In PHP, you would fetch the websites HTML source via
$html = file_get_contents('http://...');
Then use regular expressions to find those <img /> tags.
you make an ajax hit to your server sending the URL
on the server side, get the url
parse it, extract the relevant info
send back the response as a either as JSON and parse it on the client side, either straight as HTML
There is a good plugin that can be used as a headstart.
It does not fetch the image, but it's a start if you want to implement your own
http://www.webinfopedia.com/extract-meta-data-from-url-using-php.html

php and ckeditor, how to display external html

I am working on ckeditor in my php code. I would like to get some external html content displayed on ckeditor so that users can edit the content like they want. Please let me know how can I accomplish this.

Categories