<?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>IT Blog &#187; file</title>
	<atom:link href="http://blog.thuongtin.net/tag/file/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.thuongtin.net</link>
	<description>php, sql, autoit, javascript, c, html</description>
	<lastBuildDate>Tue, 15 Sep 2009 00:57:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Write to a file with PHP</title>
		<link>http://blog.thuongtin.net/2008/09/13/write-to-a-file-with-php/</link>
		<comments>http://blog.thuongtin.net/2008/09/13/write-to-a-file-with-php/#comments</comments>
		<pubDate>Sat, 13 Sep 2008 03:16:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[file]]></category>

		<guid isPermaLink="false">http://thuongtin.net/blog/?p=101</guid>
		<description><![CDATA[

$myFile = &#34;testFile.txt&#34;;
$fh = fopen($myFile, 'w') or die(&#34;can't open file&#34;);
$stringData = &#34;Bobby Boppern&#34;;
fwrite($fh, $stringData);
$stringData = &#34;Tracy Tannern&#34;;
fwrite($fh, $stringData);
fclose($fh);

Related Posts:File sao lưu dữ liệuLấy thời gian của tập tin .flvCách kiểm tra một địa chỉ có tồn tại hay khôngHàm check Page Rank của googleQui định tập tin mặc định cho thư mục]]></description>
			<content:encoded><![CDATA[<p class="dropcap-first">
<pre class="brush: php;">
$myFile = &quot;testFile.txt&quot;;
$fh = fopen($myFile, 'w') or die(&quot;can't open file&quot;);
$stringData = &quot;Bobby Boppern&quot;;
fwrite($fh, $stringData);
$stringData = &quot;Tracy Tannern&quot;;
fwrite($fh, $stringData);
fclose($fh);
</pre>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.thuongtin.net/2008/09/12/file-sao-luu-du-lieu/" rel="bookmark">File sao lưu dữ liệu</a></li><li><a href="http://blog.thuongtin.net/2008/09/12/lay-thoi-gian-cua-tap-tin-flv/" rel="bookmark">Lấy thời gian của tập tin .flv</a></li><li><a href="http://blog.thuongtin.net/2008/09/10/test/" rel="bookmark">Cách kiểm tra một địa chỉ có tồn tại hay không</a></li><li><a href="http://blog.thuongtin.net/2008/10/22/ham-check-page-rank-cua-google/" rel="bookmark">Hàm check Page Rank của google</a></li><li><a href="http://blog.thuongtin.net/2008/09/11/qui-dinh-tap-tin-mac-dinh-cho-thu-muc/" rel="bookmark">Qui định tập tin mặc định cho thư mục</a></li></ul></div><img src="http://blog.thuongtin.net/?ak_action=api_record_view&id=101&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.thuongtin.net/2008/09/13/write-to-a-file-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hàm kiểm tra file size</title>
		<link>http://blog.thuongtin.net/2008/09/11/ham-kiem-tra-file-size/</link>
		<comments>http://blog.thuongtin.net/2008/09/11/ham-kiem-tra-file-size/#comments</comments>
		<pubDate>Thu, 11 Sep 2008 04:05:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[size]]></category>

		<guid isPermaLink="false">http://thuongtin.net/blog/?p=44</guid>
		<description><![CDATA[


&#60;?php

print remote_file_size(&#34;YOUR FILE URL&#34;);

function remote_file_size ($url){
$head = &#34;&#34;;
$url_p = parse_url($url);
$host = $url_p[&#34;host&#34;];
if(!preg_match(&#34;/[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*/&#34;,$host)){
// a domain name was given, not an IP
$ip=gethostbyname($host);
if(!preg_match(&#34;/[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*/&#34;,$ip)){
//domain could not be resolved
return -1;
}
}
$port = intval($url_p[&#34;port&#34;]);
if(!$port) $port=80;
$path = $url_p[&#34;path&#34;];
//echo &#34;Getting &#34; . $host . &#34;:&#34; . $port . $path . &#34; ...&#34;;

$fp = fsockopen($host, $port, $errno, $errstr, 20);
if(!$fp) {
return false;
} else {
fputs($fp, &#34;HEAD &#34;  . ]]></description>
			<content:encoded><![CDATA[<p class="dropcap-first">
<pre class="brush: php;">

&lt;?php

print remote_file_size(&quot;YOUR FILE URL&quot;);

function remote_file_size ($url){
$head = &quot;&quot;;
$url_p = parse_url($url);
$host = $url_p[&quot;host&quot;];
if(!preg_match(&quot;/[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*/&quot;,$host)){
// a domain name was given, not an IP
$ip=gethostbyname($host);
if(!preg_match(&quot;/[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*/&quot;,$ip)){
//domain could not be resolved
return -1;
}
}
$port = intval($url_p[&quot;port&quot;]);
if(!$port) $port=80;
$path = $url_p[&quot;path&quot;];
//echo &quot;Getting &quot; . $host . &quot;:&quot; . $port . $path . &quot; ...&quot;;

$fp = fsockopen($host, $port, $errno, $errstr, 20);
if(!$fp) {
return false;
} else {
fputs($fp, &quot;HEAD &quot;  . $url  . &quot; HTTP/1.1\r\n&quot;);
fputs($fp, &quot;HOST: &quot; . $host . &quot;\r\n&quot;);
fputs($fp, &quot;User-Agent: http://www.example.com/my_application\r\n&quot;);
fputs($fp, &quot;Connection: close\r\n\r\n&quot;);
$headers = &quot;&quot;;
while (!feof($fp)) {
$headers .= fgets ($fp, 128);
}
}
fclose ($fp);
//echo $errno .&quot;: &quot; . $errstr . &quot;&lt;br /&gt;&quot;;
$return = -2;
$arr_headers = explode(&quot;\n&quot;, $headers);
// echo &quot;HTTP headers for &lt;a href='&quot; . $url . &quot;'&gt;...&quot; . substr($url,strlen($url)-20). &quot;&lt;/a&gt;:&quot;;
// echo &quot;&lt;div class='http_headers'&gt;&quot;;
foreach($arr_headers as $header) {
// if (trim($header)) echo trim($header) . &quot;&lt;br /&gt;&quot;;
$s1 = &quot;HTTP/1.1&quot;;
$s2 = &quot;Content-Length: &quot;;
$s3 = &quot;Location: &quot;;
if(substr(strtolower ($header), 0, strlen($s1)) == strtolower($s1)) $status = substr($header, strlen($s1));
if(substr(strtolower ($header), 0, strlen($s2)) == strtolower($s2)) $size   = substr($header, strlen($s2));
if(substr(strtolower ($header), 0, strlen($s3)) == strtolower($s3)) $newurl = substr($header, strlen($s3));
}
// echo &quot;&lt;/div&gt;&quot;;
if(intval($size) &gt; 0) {
$return=intval($size);
} else {
$return=$status;
}
// echo intval($status) .&quot;: [&quot; . $newurl . &quot;]&lt;br /&gt;&quot;;
if (intval($status)==302 &amp;&amp; strlen($newurl) &gt; 0) {
// 302 redirect: get HTTP HEAD of new URL
$return=remote_file_size($newurl);
}
return $return;
}

?&gt;
</pre>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.thuongtin.net/2008/09/12/lay-thoi-gian-cua-tap-tin-flv/" rel="bookmark">Lấy thời gian của tập tin .flv</a></li><li><a href="http://blog.thuongtin.net/2008/10/22/yahoo-messenger-api/" rel="bookmark">Yahoo Messenger API</a></li><li><a href="http://blog.thuongtin.net/2008/09/10/class-curl/" rel="bookmark">Class Curl</a></li><li><a href="http://blog.thuongtin.net/2008/09/12/tao-1-file-download-file/" rel="bookmark">Tạo 1 file download file</a></li><li><a href="http://blog.thuongtin.net/2008/09/12/grab-link-megaroticcom/" rel="bookmark">Grab link megarotic.com</a></li></ul></div><img src="http://blog.thuongtin.net/?ak_action=api_record_view&id=44&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.thuongtin.net/2008/09/11/ham-kiem-tra-file-size/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cách kiểm tra một địa chỉ có tồn tại hay không</title>
		<link>http://blog.thuongtin.net/2008/09/10/test/</link>
		<comments>http://blog.thuongtin.net/2008/09/10/test/#comments</comments>
		<pubDate>Wed, 10 Sep 2008 07:23:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[file]]></category>

		<guid isPermaLink="false">http://thuongtin.net/blog/?p=26</guid>
		<description><![CDATA[


&#60;?php
$test = @fopen(&#34;http://download.yahoo.com/dl/msgr75/us/yamsgr75us.exe&#34;, &#34;rb&#34;);

if ( $test )
{
print &#34;File ok&#34;;
}
else
{
print &#34;File not found&#34;;
}

?&#62;


Related Posts:jQuery: Load 1 file javascript và thực thiQuery: Get dữ liệu bằng ajaxTạo 1 file download fileHàm check Page Rank của googleT2 Room Spamer Beta ]]></description>
			<content:encoded><![CDATA[<p class="dropcap-first">
<pre>
<pre class="brush: php;">
&lt;?php
$test = @fopen(&quot;http://download.yahoo.com/dl/msgr75/us/yamsgr75us.exe&quot;, &quot;rb&quot;);

if ( $test )
{
print &quot;File ok&quot;;
}
else
{
print &quot;File not found&quot;;
}

?&gt;
</pre>
</pre>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.thuongtin.net/2008/10/27/jquery-load-1-file-javascript-va-thuc-thi/" rel="bookmark">jQuery: Load 1 file javascript và thực thi</a></li><li><a href="http://blog.thuongtin.net/2008/10/27/query-get-du-lieu-bang-ajax/" rel="bookmark">Query: Get dữ liệu bằng ajax</a></li><li><a href="http://blog.thuongtin.net/2008/09/12/tao-1-file-download-file/" rel="bookmark">Tạo 1 file download file</a></li><li><a href="http://blog.thuongtin.net/2008/10/22/ham-check-page-rank-cua-google/" rel="bookmark">Hàm check Page Rank của google</a></li><li><a href="http://blog.thuongtin.net/2008/11/01/t2-room-spamer-beta-1/" rel="bookmark">T2 Room Spamer Beta 1</a></li></ul></div><img src="http://blog.thuongtin.net/?ak_action=api_record_view&id=26&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.thuongtin.net/2008/09/10/test/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
