Hi guys ..
Here I am going to share how to fetch/extract url datas like title , description and images from a website like facebook attach url module
I have used PHP curl to fetch the webpage content as a string. And I have used PHP Domdocument object to extract the meta title and description part.
Finally I have used preg_match_all function to fetch images from the webpage
here is the code below
[php][file]http://w3lessons.info/wp-content/uploads/2012/01/facebook-like-fetch-url-data.txt[/file][/php]Check out my latest facebook scripts
- Facebook Style Youtube Video Expander with JQuery – http://w3lessons.info/2013/05/08/facebook-style-youtube-video-expanding-with-jquery/
- Facebook Style Wall Script 3.0 – http://w3lessons.info/2013/04/21/facebook-wall-script-3-0-timeline-oauth-location-sharing-smileys-many-more/
Everything is very open with a clear explanation of the issues.
It was definitely informative. Your website is very helpful.
Thank you for sharing!
The demo currently didn’t work shows message ”
Update Your Browser | Facebook
” .
As I see it returns Title and description Only .
I already have code that return only FaceBook upper and footer Div no page contents at all . I don’t know why but I think that data scrapped using Ajax o native Javascript codes .
The demo currently didn’t work shows message ”
Update Your Browser | Facebook
” .
As I see it returns Title and description Only .
I already have code that return only FaceBook upper and footer Div no page contents at all . I don’t know why but I think that data scrapped using Ajax o native Javascript codes .
Hi,
this is really nice script, but it is not working with the sites having slideshows or ajax data.
Can you tell me resolution for same?
thanks.
Hi Dhvani,
Could you please share the url/link?
So that I can test it from my end
Thanks
I am getting the following error in wamp “Fatal error: Call to a member function loadHTML() on a non-object “
i like this
thanks you Karthikeyan K
Great job for Facebook Wall Script 5.0
Notice: Undefined offset: 19 in C:xampphtdocsyohyohextractimageextractnewcurl_fetch.php on line 69
Hi Karthikeyan K, it won’t working with other page like mp3 zing vn .Please help me. Thanks
Thank you sachin
Its not working properly . In demo its working properly but when i download it and try to use , I give link in input field but its not fetching title , description and image also Please suggest .
thank in advance
Hi Gaurav,
Please make sure that CURL is enabled in your server or not.. & then let me know
Thanks
Hi Karthikeyan,
If you post this URL on FB wall — http://www.justjammu.com/info then the information it is fetching incorrect title and description, whereas the above URL has Title and description and same URL is fetching correct information on your Demo Page (http://itzurkarthi.com/demo/facebook-like-fetch-url-data/)
Thank you very much.
how to insert tis data to a data base .please help
Thanks for good script, clean and funcional!
cheers dude this is helpful
i think you site is going vary good, so i suggest you please quick change you wordpress site into core php site its is hackable by any one
Thanks for the code but it didn’t work.. It’s giving the following error:
Fatal error: Call to undefined function curl_init() in D:AppServwwwelandzfacebook-like-fetch-url-datacurl_fetch.php on line 20
i am getting the following fatal error plz help
Call to undefined function curl_init()
Could you please check the ws. http://stipistop.com
the images are not feched.
Hello, probe with the youtube link but the photos are not displayed
Same problem on my localhost … its showing few errors same as Khaljava …
I have enabled my localhost for curl … but still the script is not working
http://i604.photobucket.com/albums/tt125/qwertyman69/fbsexample.jpg
Thanks for so quick reply.
I don’t understand that example can run only on server. After uplouding it to my localhost (Vertrigo Server) it started work. But with errors
Notice: Undefined variable: description in
VertrigoServwwwcurl_fetch.php on line 69 and on line 91
I downloaded example, but it doesn’t work at all.
After submitting FireBug sad that:
Node cannot be inserted at the specified point in the hierarchy
b[0]&&b[0].ownerDocument||c);var h=[],…a:a+”px”)}}),a.jQuery=a.$=f})(window);
jquery-1.6.1.min.js
Maybe jQuery not fresh?
Hi Khaljava,
Thanks for your comment.. May I know your server details? Is Curl is enabled in your server?
Thanks
Karthikeyan K
Hi !!
It’s very nice … thank you for this
But I have some problems in this app
this function curl_init(); … it don’t want to engaging … I use appserv 2.5.8 for Windows
Why is the demo not working?
Hi Sean,
Now check it out. – http://w3lessons.info/demo/facebook-like-fetch-url-data/
let me know If you any problem..
Thanks
Karthikeyan K
when you trying to open the file
if you getting the following:
Fatal error: Call to undefined function: curl_init()
It is maybe for one of these reasons
If this is with a hosting company, you will need to have them install/enable it.
If this is a Windows based system, CURL can be enabled by uncommenting the curl extension line in the php.ini file – extension=php_curl.dll and restarting the web server.
If this is Unix/Linux, PHP must be compiled with CURL support and the libcurl library must be installed.
Can you help me in implementing this functionality using c#.net
Well done kartik…i have one doubt..currently i am working in .net,i need like this kind of extratcting url data other then PHP..can u help me to do? thanks in advance
Thanks for your comment udhay!
I am very glad to help you in that.. tell me what sort of information do you need from me?
Thanks
Karthikeyan K
it works very well on restricted hosting providers as well..good job
thanks
Thanks Karthik.. 🙂
thanks…..
nice work…..