<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CatyCat İnternet &#187; description</title>
	<atom:link href="http://www.catycat.net/tag/description/feed" rel="self" type="application/rss+xml" />
	<link>http://www.catycat.net</link>
	<description>Web teknolojilerine alternatif bakış açısı</description>
	<lastBuildDate>Wed, 24 Feb 2010 18:42:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>PHP ve AJAX ile Title, Description, Keywords, Thumbnail Alma</title>
		<link>http://www.catycat.net/php-ve-ajax-ile-title-description-keywords-thumbnail-alma</link>
		<comments>http://www.catycat.net/php-ve-ajax-ile-title-description-keywords-thumbnail-alma#comments</comments>
		<pubDate>Fri, 17 Jul 2009 11:50:22 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[İnternet]]></category>
		<category><![CDATA[açıklama]]></category>
		<category><![CDATA[anahtar kelimeler]]></category>
		<category><![CDATA[başlık]]></category>
		<category><![CDATA[description]]></category>
		<category><![CDATA[get_meta_tags]]></category>
		<category><![CDATA[keywords]]></category>
		<category><![CDATA[önizleme resmi]]></category>
		<category><![CDATA[thumbnail]]></category>
		<category><![CDATA[title]]></category>
		<category><![CDATA[website thumbnail]]></category>

		<guid isPermaLink="false">http://www.catycat.net/?p=161</guid>
		<description><![CDATA[Uzun bir aradan sonra yeni bir yazıyla tekrar karşınızdayım. Bu yazıda bir web adresindeki başlık, açıklama, anahtar kelimeler ve sayfanın önizleme resmini nasıl okuyup, kullanacağımızdan bahsedeceğim. Örneğimizde PHP ve AJAX kullanacağız ki bu ikili her derde çare. Keyifli bir yazı olması dileğiyle konuya balıklama dalıyorum. Öncelikle kullanıcının web adresini gireceği bir html sayfası oluşturuyoruz. &#60;html&#62; [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-168" title="meta_tags" src="http://www.catycat.net/wp-content/uploads/2009/07/meta_tags.PNG" alt="meta_tags" width="194" height="125" />Uzun bir aradan sonra yeni bir yazıyla tekrar karşınızdayım. Bu yazıda bir web adresindeki başlık, açıklama, anahtar kelimeler ve sayfanın önizleme resmini nasıl okuyup, kullanacağımızdan bahsedeceğim. Örneğimizde PHP ve AJAX kullanacağız ki bu ikili her derde çare. Keyifli bir yazı olması dileğiyle konuya balıklama dalıyorum.<br />
<span id="more-161"></span><br />
Öncelikle kullanıcının web adresini gireceği bir html sayfası oluşturuyoruz.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>PHP ile Title, Description, Keywords, Thumbnail Alma - CatyCat<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">http-equiv</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Content-Type&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/html; charset=UTF-8&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">language</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;eyceks/eyceks.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span>
function get_url(){ 
	var url1 = document.getElementById('url').value;
	url2 = fc_(url1);
	var sc = 'url3='+ url2;
		JXP(1, &quot;info&quot;, &quot;get_url.php&quot;, sc);
   }
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">table</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span>Website URL:<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span>http://<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;url&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;url&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
	<span style="color: #009900;">&lt;!– Butona tıklandığında get_url<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> fonksiyonuna değer gönderiyoruz. –&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;button&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Send&quot;</span> <span style="color: #000066;">onClick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;get_url()&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">table</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;info&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></div></div>

<p>Oluşturduğumuza sayfada url id&#8217;sine sahip input alanındaki değeri <strong>&#8220;get_url()&#8221;</strong> isimli fonksiyona gönderdik. Girilen değer fonksiyona girdikten sonra AJAX yardımıyla bu değeri &#8220;get_url.php&#8221; sayfasına gönderiyoruz. Şimdi get_url.php sayfasını oluşturalım.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// temizlik</span>
<span style="color: #000088;">$url3</span><span style="color: #339933;">=</span><span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// http:// kontrolü</span>
<span style="color: #000088;">$url_control</span><span style="color: #339933;">=</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url3</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">7</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$url_control</span><span style="color: #339933;">!=</span><span style="color: #0000ff;">&quot;http://&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$url3</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$url3</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// title bilgisini alıyoruz.</span>
<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/&lt;title&gt;(.+)&lt;\/title&gt;/i&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span><span style="color: #000088;">$m</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;b&gt;Title:&lt;/b&gt; '</span><span style="color: #339933;">.</span><span style="color: #000088;">$m</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">else</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;The page doesn't have a title tag!&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// keyword bilgilerini alıyoruz.    </span>
<span style="color: #000000; font-weight: bold;">function</span> keywords<span style="color: #009900;">&#40;</span><span style="color: #000088;">$site</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #000088;">$metetags</span> <span style="color: #339933;">=</span> <span style="color: #990000;">get_meta_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$site</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$key</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$metetags</span><span style="color: #009900;">&#91;</span>keywords<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$metetags</span> <span style="color: #339933;">=</span> <span style="color: #990000;">get_meta_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$site</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$key</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$metetags</span><span style="color: #009900;">&#91;</span>keyword<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
 <span style="color: #b1b100;">return</span> <span style="color: #000088;">$key</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>  
&nbsp;
<span style="color: #666666; font-style: italic;">// description bilgisini alıyoruz.</span>
 <span style="color: #000088;">$metetags</span> <span style="color: #339933;">=</span> <span style="color: #990000;">get_meta_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$desc</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$metetags</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'description'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;b&gt;Description:&lt;/b&gt; '</span><span style="color: #339933;">.</span><span style="color: #000088;">$desc</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;b&gt;Keywords:&lt;/b&gt; '</span><span style="color: #339933;">.</span>keywords<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// website thumbnail</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;b&gt;Thumbnail:&lt;/b&gt;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$thumboo_api</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;your_thumboo_code_here&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$thumboo_url</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$url3</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$thumoo_params</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;u=&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_HOST&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span>
<span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;REQUEST_URI&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&amp;su=&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$thumboo_url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&amp;c=medium&amp;api=&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$thumboo_api</span><span style="color: #339933;">;</span>
<span style="color: #339933;">@</span><span style="color: #990000;">readfile</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://counter.goingup.com/thumboo/snapshot.php?&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$thumoo_params</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Bu sayfada öncelikle girilen adresteki başlık bilgilerini okumak için <strong>&#8220;file&#8221;</strong> fonksiyonunu kullandık. Sonrasında sayfada</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span></pre></div></div>

<p>arattık ve arasında kalanları okuyup sayfanın başlığını öğrenmiş olduk.</p>
<p>İkinci olarak sayfadaki anahtar kelimler için <strong>&#8220;get_meta_tags&#8221;</strong> fonksiyonunu kullandık ve bu sayede sayfanın anahtar kelimelerini(keywords) öğrendik. Yine aynı fonksiyon yardımıyla sayfanın açıklama(description) bilgilerini öğrenmiş olduk.</p>
<p>Son olarak sayfanın bir önizleme resmini ekrana dökmek için çeşitli servisler mevcut. Bu uygulama için <a title="Thumboo" href="http://www.thumboo.com/">Thumboo</a> isimli bir aracı kullandım. Aracı kullanmak için servise kayıt olduktan sonra &#8220;My Account&#8221; bölümünde sizin için oluşturulmuş kodu sağ tarafta &#8220;Your API Key&#8221; bölümünde görebilirsiniz. O kodu kopyalayıp &#8220;your_thumboo_code_here&#8221; bölümüne yapıştırıyoruz ve artık girilen adresin önizleme resmini alabiliyoruz.</p>
<p>Uygulamanın bir örneğini CatyCat&#8217;te test edebilir dilerseniz bilgisayarınıza indirebilirsiniz.</p>
<p><a title="Test Sürüşü" href="http://catycat.net/test/get_url_info/">Test Sürüşü</a></p>
<p><a title="Download PHP ve AJAX ile Title, Description, Keywords, Thumbnail Alma" href="http://www.box.net/shared/b4cs13nih9">Download</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.catycat.net/php-ve-ajax-ile-title-description-keywords-thumbnail-alma/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
