Posting to Facebook from website with Facebook Connect

17 gennaio 2010 - Fonte: http://www.barattalo.it
This post is part of the Facebook Connect Tutorial and it will show how to add “post to wall” function to your community. Since every community is different, and since every community has different services we want to create a fbcpost.php file that can be connected to everything your users do. So we want to [...] Related posts:
  1. Copying remote files on your server with PHP
  2. href="http://www.barattalo.it/OnKeyUp Fix Alphanumerical Chars
  3. href="http://www.barattalo.it/...

    Leggi il seguito »

PHP Web page to text function

16 gennaio 2010 - Fonte: http://www.barattalo.it
I’ve found this nice small bot on the www.php.net site, thanks to the author of the script on the preg_replace page. This bot returns the text content of a url and it could be used to take text from a site and find relevant words to search. It’s nice because it uses CURL and let us see [...] Related posts:
  1. Set “write here” on input type text?
  2. href="http://www.barattalo.it/Test if a remote url exists with PHP and CURL
  3. href="http://www.barattalo.it/...

    Leggi il seguito »

Copying remote files on your server with PHP

16 gennaio 2010 - Fonte: http://www.barattalo.it
Here is a function that let you copy remote files (remote images, for example) on your web site. This can be done also with CURL, but this function it’s enaugh if you’re not making some real splider job: function copyFile($url,$filename){ $file = fopen ($url, "rb"); if (!$file) return false; else { $fc = fopen($filename, "wb"); while (!feof ($file)) { $line = [...] Related posts:
  1. Posting to Facebook from website with Facebook Connect
  2. href="http://www.barattalo.it/...

    Leggi il seguito »

Bot that retrieves url meta data and other infos

12 gennaio 2010 - Fonte: http://www.barattalo.it
From a given url this function retrieves page title, meta description, keywords, favicon, and an array of 5 images to use for links. It call file_get_contents and then make some regular expression job. This function is included in the Mini Bots Class. print_r(getLinksInfo("http://www.rockit.it/articolo/825/nada-studio-report-quando-nasce-una-canzone")); function getLinksInfo($url) { $web_page = file_get_contents($url); $data['keywords']=""; $data['description']=""; $data['title']=""; $data['favicon']=""; $data['images']=array(); preg_match_all('#<title([^>]*)?>(.*)</title>#Uis', $web_page, $title_array); $data['title'] = $title_array[2][0]; preg_match_all('#<meta([^>]*)(.*)>#Uis', $web_page, $meta_array); for($i=0;$i<count($meta_array[0]);$i++)...

Leggi il seguito »

Test if a remote url exists with PHP and CURL

6 gennaio 2010 - Fonte: http://www.barattalo.it
If you have to test if a local file exists you will probably use the php file_exists function, but if you have to test a remote file, that is to say a remote url, than you can use CURL and get the headers returned by the http request. If you receive a 200 code, than [...] Related posts:
  1. Tiny url encode and decode with PHP
  2. href="http://www.barattalo.it/PHP Web page to text function
  3. href="http://www.barattalo.it/...

    Leggi il seguito »

Tiny url encode and decode with PHP

29 dicembre 2009 - Fonte: http://www.barattalo.it
The first functions make short urls using tinyurl.com service. It’s a very popular function on the web, you can find it in a lot of files, and it’s always the same: function doShortURL($url) { $short_url= file_get_contents('http://tinyurl.com/api-create.php?url=' . urlencode( $url ) ); return $short_url; } The second function decode a short url in a simple way: I’ve used CURL to get [...] Related posts:
  1. Test if a remote url exists with PHP and CURL
  2. href="http://www.barattalo.it/...

    Leggi il seguito »

Validate email with smtp

27 dicembre 2009 - Fonte: http://www.barattalo.it
This function validate a mail address in a smart way: if the address to validate has a correct syntax (checked with regular expression), it tries to connect to the mx server of the address. This means that the program have to use the smtp protocol to talk with each mx server registered in the dns [...] Related posts:
  1. Sending HTML emails with attachment with PHP
...

Leggi il seguito »