February 14, 2008
Hi I was desperate to make this work when I finally heard of youtube APIs, through which you can actually get all the information of any video from youtube. I will put the source of phpyoutube if someone needs it.
There are few basic steps to do in your PHP code which are as below:
include(”phpYoutube.php”);
$dev_id = “XXXXXXXX”;
$account = “XXXXXXXX”;
$phpYoutube = new phpYoutube($dev_id);
$videos=print_r($phpYoutube->videos_getdetails(”m2fMYM9rJfc”));
$thumbnail_url = $videos['thumbnail_url'];
echo $thumbnail_url;
This is the simplest way to get the image from youtube using API’s
Hope this could help someone.
No Comments » |
Uncategorized | Tagged: image, thumb, video, youtube |
Permalink
Posted by adnanrafe
February 11, 2008
I need to make few basic changes on my local Windows Server to make gettext run properly. My local server is Windows with apache2.2.1 and php5.
- Enable the gettext.dll extention in php.ini file
- Download iconv.dll and put it under ext folder in PHP, this will enable the iconv extention.
In your global file in PHP just put this code
$language=$_SESSION['LanguageNm'];
putenv(”LANG=$language”);
setlocale(LC_ALL, $language);
$domain = ‘messages’;
include “locale”;
bindtextdomain($domain, “locale”);
bind_textdomain_codeset (domain, codeset); //Important for getting rid of question marks in translated words
textdomain($domain);
For making it run on Linux I had to make a small modification . The issue was on windows I was taking the language variable to be “es” or “ar” for Spanish or Arabic languages etc. but on linux it needs to be defined in a different way like “es_ES” or “ar_AR” so just change this line in the above code from
$language=$_SESSION['LanguageNm'];
to
$language=$_SESSION['LanguageNm'].”_”.strtoupper($_SESSION['LanguageNm'])
Hope this could help someone saving precious time
No Comments » |
Web | Tagged: gettext, linux, multilingual, translation |
Permalink
Posted by adnanrafe
February 8, 2008
It took a while for me to understand that you can actually send multilingual characters in Subject of mail. This is easy to integrate if you are hardcoding it within the code, but if you are taking it from the user then you need to make certain changes.
PHP_VALUE mbstring.language Neutral
PHP_VALUE mbstring.internal_encoding UTF-8
PHP_VALUE mbstring.encoding_translation On
PHP_VALUE mbstring.http_input auto
PHP_VALUE mbstring.http_output UTF-8
PHP_VALUE mbstring.detect_order auto
PHP_VALUE mbstring.substitute_character none
PHP_VALUE default_charset UTF-8
Use mbstring_mail();
Hope this could help somebody.
No Comments » |
Web | Tagged: arabic, characters, charset, junk, mail, php, subject |
Permalink
Posted by adnanrafe
January 8, 2008
If you are trying to parse an “XML Feed” in PHP4 somewhat like this way :
$titles->item(0)->nodeValue;
then it wont work in PHP4 because its a chaining process and only works in PHP5
2 Comments |
Web | Tagged: parser, php, php parser |
Permalink
Posted by adnanrafe
December 24, 2007
Hi friends I really had a hectic time making the friendly URL run on my Linux Server. Locally being on windows I didn’t had to do much apart from just enabling the “mod_rewrite” option and thats enough to make the friendly URL work on apache installed locally on my machine.
To make it run on Linux you need to make the following changes in the .htaccess file
RewriteEngine On
If you have something like http://www.yourdomain.com/index.php?url=test
or
If you have something like http://www.yourdomain.com/news/test working locally then you need to write the following
in your .htaccess file
- RewriteRule ^([^/\.]+)/?$ /$1.php [L]
$1 -> This refers to the first parameter and it informs the Apache that its a php file and redirects it accordingly.
- RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /$1.php/$2 [L]
$1 -> Refers to “news” in the URL mentioned above.
$2 -> Refers to “test” in the URL mentioned above.
So just keep on increasing the slashes as the number of parameters keep on increasing.
………………..
- RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /$1.php/$2/$3 [L]
- RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /$1.php/$2/$3/$4 [L]
- RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /$1.php/$2/$3/$4/$5 [L]
Hope this help would save your precious time to an extent If yes … leave your comment ..
No Comments » |
Web | Tagged: apache, htaccess, linux, mod, mod_rewrite, rewrite |
Permalink
Posted by adnanrafe