<?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/"
	>

<channel>
	<title>Georgi Mitev &#124; Learn Scripts Tutorials &#124; PHP Web games</title>
	<atom:link href="http://georgi-mitev.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://georgi-mitev.com</link>
	<description>shock's place to chill-out and have some fun</description>
	<pubDate>Sun, 10 May 2009 07:08:15 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>HTTP, HTTPS, and SSL via PHP</title>
		<link>http://georgi-mitev.com/2009/05/10/http-https-and-ssl-via-php/</link>
		<comments>http://georgi-mitev.com/2009/05/10/http-https-and-ssl-via-php/#comments</comments>
		<pubDate>Sun, 10 May 2009 07:08:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[https]]></category>

		<category><![CDATA[https and php]]></category>

		<category><![CDATA[https via php]]></category>

		<category><![CDATA[socket]]></category>

		<category><![CDATA[sockets]]></category>

		<category><![CDATA[ssl]]></category>

		<category><![CDATA[ssl and php]]></category>

		<category><![CDATA[ssl via php]]></category>

		<guid isPermaLink="false">http://georgi-mitev.com/?p=81</guid>
		<description><![CDATA[Today i found this very cool tutorial regarding the using of using ssl with PHP.
I&#8217;ll copy here the most interesting of it.
HTTP with PHP Sockets
// don&#8217;t need to specify http, it&#8217;s the default protocol
$hostname = &#8220;www.google.com&#8221;;
$port     = 80;
// create and configure the client socket
$fp = fsockopen($hostname, $port); // optional: $error_number, $error_string, [...]]]></description>
			<content:encoded><![CDATA[<p>Today i found this very cool tutorial regarding the using of using ssl with PHP.</p>
<p>I&#8217;ll copy here the most interesting of it.</p>
<h2><a name="http-sockets">HTTP with PHP Sockets</a></h2>
<p>// don&#8217;t need to specify http, it&#8217;s the default protocol<br />
$hostname = &#8220;www.google.com&#8221;;<br />
$port     = 80;</p>
<p>// create and configure the client socket<br />
$fp = fsockopen($hostname, $port); // optional: $error_number, $error_string, $connect_timeout<br />
if ($fp) {<br />
    stream_set_timeout($fp, 30); // seconds to wait for i/o operations</p>
<p>    // send request headers<br />
    fwrite($fp, &#8220;GET / HTTP/1.1\r\n&#8221;);<br />
    fwrite($fp, &#8220;Host: $hostname\r\n&#8221;);<br />
    fwrite($fp, $additional_headers); // Accept, User-Agent, Referer, etc.<br />
    fwrite($fp, &#8220;Connection: close\r\n&#8221;);</p>
<p>    // read response<br />
	$response = &#8220;&#8221;;<br />
    while (!feof($fp)) {<br />
        $response .= fgets($fp, 128);<br />
    }<br />
	echo $response;</p>
<p>    // close the socket<br />
    fclose($fp);<br />
}<br />
<span id="more-81"></span></p>
<h2><a name="raw-ssl-sockets">Direct SSL Sockets in PHP</a></h2>
<p>You don&#8217;t have to send request headers in the above example. You can actually connect to some servers and send raw text with <code>fwrite</code>. Because you have to implement the HTTP/HTTPS protocol yourself if you want it, sockets are considered &#8220;clean&#8221; connections.<br />
You don&#8217;t have to send request headers in the above example. You can actually connect to some servers and send raw text with fwrite. Because you have to implement the HTTP/HTTPS protocol yourself if you want it, sockets are considered &#8220;clean&#8221; connections.</p>
<p>// note that &#8220;ssl&#8221; is the protocol, NOT &#8220;https&#8221;<br />
$hostname  = &#8220;ssl://your-secure-site.com&#8221;;<br />
$port      = 443;</p>
<p>// create and configure the client socket<br />
$fp = fsockopen($hostname, $port);<br />
if ($fp) {<br />
    stream_set_timeout($fp, 30);</p>
<p>	// send data (or build HTTPS headers similar to first example)<br />
	fwrite($fp, &#8220;your message goes here&#8221;);</p>
<p>    // read response<br />
    while (!feof($fp)) {<br />
        echo fgets($fp, 128);<br />
    }</p>
<p>    // close the socket<br />
    fclose($fp);<br />
}</p>
<h2><a name="https-curl">HTTPS via cURL</a></h2>
<p>PHP doesn&#8217;t directly support attaching client certificates to web requests with <code>fsockopen</code>, so  you have to use the <code>cURL</code> library.<br />
$url = &#8220;https://your-secure-site.com/secure-service.php&#8221;;<br />
$port = 443;</p>
<p>// POST data, formatted just like a GET query string<br />
$request = &#8220;name=hb&amp;age=27&amp;site=arguments.callee.info&#8221;;</p>
<p>// the client certificate path MUST be a physical path, not url<br />
$certificate = &#8220;C:\\certificates\\test.crt&#8221;; // windows example<br />
$certificate = &#8220;/etc/pki/tls/private/test.crt&#8221;; // unix/linux example<br />
$password = &#8216;mypassword&#8217;; // client certificate&#8217;s key</p>
<p>// more details at http://php.net/curl<br />
$ch = curl_init();<br />
curl_setopt($ch, CURLOPT_POST, 1);<br />
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br />
curl_setopt($ch, CURLOPT_URL, $url);<br />
curl_setopt($ch, CURLOPT_PORT, $port);<br />
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);<br />
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);<br />
curl_setopt($ch, CURLOPT_SSLCERT, $certificate);<br />
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, $password);</p>
<p>// fetch response and close the socket<br />
$response = curl_exec($ch);<br />
curl_close($ch);</p>
]]></content:encoded>
			<wfw:commentRss>http://georgi-mitev.com/2009/05/10/http-https-and-ssl-via-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>mysql copy entire database to remote host</title>
		<link>http://georgi-mitev.com/2009/04/17/mysql-copy-entire-database-to-remote-host/</link>
		<comments>http://georgi-mitev.com/2009/04/17/mysql-copy-entire-database-to-remote-host/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 12:27:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[backup remote host]]></category>

		<category><![CDATA[copy database]]></category>

		<category><![CDATA[copy database to remote host]]></category>

		<category><![CDATA[db backup mysql]]></category>

		<category><![CDATA[mysqldump command]]></category>

		<category><![CDATA[mysqldump remote host]]></category>

		<category><![CDATA[remote database backup]]></category>

		<category><![CDATA[remote db backup]]></category>

		<guid isPermaLink="false">http://georgi-mitev.com/?p=203</guid>
		<description><![CDATA[I needed to create a backup on my mysql database on remote host. I found out that there is a way that you can actually do that with mysqldump :). I didn&#8217;t believe that it will be so easy but i decided to give it a try. After all the stuff i read on the [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to create a backup on my mysql database on remote host. I found out that there is a way that you can actually do that with mysqldump :). I didn&#8217;t believe that it will be so easy but i decided to give it a try. After all the stuff i read on the net about it there was&#8217;nt a single working example of it - so after some testing i managed to do it <img src='http://georgi-mitev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
so here it is:</p>
<p>first i will show you how to use mysqldump to backup your database on your harddrive on your local computer under windows. Go to your command prompt -> Start -> Run -> write &#8220;cmd&#8221; -> hit enter<br />
go to your mysql bin directory, in case that you use xampp, and it&#8217;s installed on c:\xampp, it should be in c:\xampp\mysql\bin<br />
you can do that by typing &#8220;cd \&#8221; and then &#8220;cd xampp\mysql\bin&#8221; (i&#8217;m trying to write this tutorial as simple as possible so that everybody will get it <img src='http://georgi-mitev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ) </p>
<p>after that, to backup your database on local mashine you should write:<br />
mysqldump &#8211;add-drop-table -h localhost &#8211;user=root &#8211;password=yourpass yourDBname > OutputFile.sql</p>
<p>voilla <img src='http://georgi-mitev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>so if you want to backup your database to remote host the command gets a bit more sophisticated <img src='http://georgi-mitev.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
here we go:</p>
<p>copy databse and it&#8217;s data from one server to another:<br />
mysqldump &#8211;user=root &#8211;password=yourPassword &#8211;opt localDB | mysql -h 192.168.1.35 &#8211;user=root &#8211;password=remotePassword remoteDB</p>
<p>In our case we copy our local database &#8220;localDB&#8221; into the database &#8220;remoteDB&#8221; on the machine with 192.168.1.35</p>
<p>we can also do the command like this:<br />
mysqldump -h 192.168.1.17 &#8211;user=test &#8211;password=12345 &#8211;opt remoteDB<br />
 | mysql -h 192.168.1.51 &#8211;user=root &#8211;password=bg_820918 remoteDB</p>
<p>in this case we copy the database &#8220;remoteDB&#8221; from remote host to another remote host in the database &#8220;remoteDB&#8221;</p>
<p>now you see how powerfull mysqldump really is, and that&#8217;s only few of the things it&#8217;s capable of <img src='http://georgi-mitev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
I hope this will was usefull for someone <img src='http://georgi-mitev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://georgi-mitev.com/2009/04/17/mysql-copy-entire-database-to-remote-host/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Simple script to feed your site with some RSS that you like ;)</title>
		<link>http://georgi-mitev.com/2009/04/08/simple-script-to-feed-your-site-with-some-rss/</link>
		<comments>http://georgi-mitev.com/2009/04/08/simple-script-to-feed-your-site-with-some-rss/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 12:10:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[import feed]]></category>

		<category><![CDATA[include feed]]></category>

		<category><![CDATA[php script]]></category>

		<category><![CDATA[put feed]]></category>

		<category><![CDATA[rss]]></category>

		<category><![CDATA[xml rss]]></category>

		<guid isPermaLink="false">http://georgi-mitev.com/?p=193</guid>
		<description><![CDATA[Hello fellas,  because these days i had a case where i had to include some RSS feed on my site and i needed a very simple and fast solution in php how to do it i was very dissapointed from what i&#8217;ve found on the web. There are all kind of widgets, tools PHP scripts [...]]]></description>
			<content:encoded><![CDATA[<p>Hello fellas,  because these days i had a case where i had to include some RSS feed on my site and i needed a very simple and fast solution in php how to do it i was very dissapointed from what i&#8217;ve found on the web. There are all kind of widgets, tools PHP scripts using the xml-reader class, whatever - but i just needed some very simple solution. So ofcourse i had to write it myself at the end <img src='http://georgi-mitev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>in this example i&#8217;m going to import feed from yahoo&#8217;s technology news rss:</p>
<p><span id="more-193"></span></p>
<p>first i&#8217;m going to use the &#8220;simplexml_load_file&#8221; to check what we got in this yahoo url</p>
<p>&lt;?php<br />
$xmlobj = simplexml_load_file(&#8221;http://rss.news.yahoo.com/rss/tech&#8221;);<br />
print header(&#8221;Content-type: text/plain&#8221;);<br />
print_r($xmlobj);<br />
?&gt;</p>
<p>my output on the browser looks like this</p>
<pre>SimpleXMLElement Object
(
    [@attributes] =&gt; Array
        (
            [version] =&gt; 2.0
        )

    [channel] =&gt; SimpleXMLElement Object
        (
            [title] =&gt; Yahoo! News: Technology News
            [copyright] =&gt; Copyright (c) 2009 Yahoo! Inc. All rights reserved.
            [link] =&gt; http://news.yahoo.com/i/738
            [category] =&gt; technology
            [description] =&gt; Technology News
            [language] =&gt; en-us
            [lastBuildDate] =&gt; Wed, 08 Apr 2009 12:02:30 GMT
            [ttl] =&gt; 5
            [image] =&gt; SimpleXMLElement Object
                (
                    [title] =&gt; Yahoo! News
                    [width] =&gt; 142
                    [height] =&gt; 18
                    [link] =&gt; http://news.yahoo.com/i/738
                    [url] =&gt; http://l.yimg.com/a/i/us/nws/th/main_142b.gif
                )

            [item] =&gt; Array
                (
                    [0] =&gt; SimpleXMLElement Object
                        (
                            [title] =&gt; Cable's answer to online's ad success: targeting
    (AP)

                            [link] =&gt; http://us.rd.yahoo.com/dailynews/rss/tech/*http://news.yahoo.com/s/ap/20090407/ap_on_hi_te/cable_targeted_advertising

                            [category] =&gt; technology
                            [pubDate] =&gt; Tue, 07 Apr 2009 20:37:20 GMT
                            [description] =&gt; &lt;p&gt;&lt;a href="http://us.rd.yahoo.com/dailynews/rss/tech/*http://news.yahoo.com/s/ap/20090407/ap_on_hi_te/cable_targeted_advertising"&gt;&lt;img src="http://d.yimg.com/a/p/ap/20090407/capt.0d1190bc652444d0b0f4eb9bb9f0836c.cable_targeted_advertising_nybz175.jpg?x=130&amp;y=86&amp;q=85&amp;sig=52xM5q9qwuq.Eq2_2pqO3A--" align="left" height="86" width="130" alt="FILE - In this April 2, 2009 file photo, a view of the user interface for Tru2way technology is seen on display inside the Broadband Nation exhibit at The Cable Show at the Washington Convention Center in Washington. Cable's efforts to standardize their systems around Tru2way will make it easier to deploy so-called 'addressable' ads regardless of operator, said Dallas Clement, senior vice president of strategy and development at Cox Communications. (AP Photo/Gerald Herbert, file)" border="0" /&gt;&lt;/a&gt;AP - You're watching Jon Stewart's "The Daily Show," when suddenly you see a commercial for the Mustang convertible you've been eyeing Â— with a special promotion from Ford, which knows you just ended your car lease.&lt;/p&gt;&lt;br clear="all"/&gt;
                        )

so i won't be needing the RSS's channel news, i want only the items in that -&gt; so i do:
&lt;?php
$xmlobj = simplexml_load_file("http://rss.news.yahoo.com/rss/tech");
print header("Content-type: text/plain");
print_r($xmlobj-&gt;channel-&gt;item);
?&gt;

after that i can remove the "print header("Content-type: text/plain");" ( i used it just not to show the images but to be able to see all the site just like a raw text <img src='http://georgi-mitev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> )

<strong>so all the code that i'm going to need for my RSS Feed importer will be :</strong>

&lt;?php
$xmlobj = simplexml_load_file("http://rss.news.yahoo.com/rss/tech");

foreach($xmlobj-&gt;channel-&gt;item as $item){
	echo "&lt;a href='".$item-&gt;link."'&gt;".$item-&gt;title."&lt;/a&gt;&lt;br /&gt;";
	echo $item-&gt;description."&lt;br /&gt;";
}
?&gt;
and here is the result:

<a rel="lightbox" href="http://georgi-mitev.com/images/posts/4.2009/rss.jpg"><img title="including rss from yahoo feeder using php" src="http://georgi-mitev.com/images/posts/4.2009/rss.jpg" alt="including rss from yahoo feeder using php" width="600" height="340" /></a>

<strong>so 4 rows in php and voilla( i hope that's the way to spell it :))
</strong>we gotta fully working RSS(xml) importer for our shiny site -)</pre>
]]></content:encoded>
			<wfw:commentRss>http://georgi-mitev.com/2009/04/08/simple-script-to-feed-your-site-with-some-rss/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Simple Object Oriented aspects PHP</title>
		<link>http://georgi-mitev.com/2009/03/30/simple-object-oriented-aspects-php/</link>
		<comments>http://georgi-mitev.com/2009/03/30/simple-object-oriented-aspects-php/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 05:44:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[constructor]]></category>

		<category><![CDATA[database link]]></category>

		<category><![CDATA[inheritance]]></category>

		<category><![CDATA[mysqli]]></category>

		<category><![CDATA[object oriented php]]></category>

		<category><![CDATA[php class]]></category>

		<category><![CDATA[__constructor]]></category>

		<guid isPermaLink="false">http://georgi-mitev.com/?p=171</guid>
		<description><![CDATA[I&#8217;m going to talk about some good object oriented practices for small/medium projects. The object oriented programming itself will save you enourmous amount of time. The inheritance is part of the Object Oriented Programming (OOP) and is very good thing that is going to save you even more time when you start to use some [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m going to talk about some good object oriented practices for small/medium projects. The object oriented programming itself will save you enourmous amount of time. The inheritance is part of the Object Oriented Programming (OOP) and is very good thing that is going to save you even more time when you start to use some object oriented model in your programming. </p>
<p>Let&#8217;s say we need to have some root class - lets say &#8220;Base&#8221;, with the __construct() (the class&#8217;s constructor) - notice that since PHP 5.0 the constructor of a class is defined in __constructs(), instead of &#8220;the-name-of-your-class&#8221;(). Anyway you can define the constructor information in Base() as well, but better do it in __construct, because you don&#8217;t know if there will be support for the old PHP 4 constructors in PHP 6 <img src='http://georgi-mitev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>so let&#8217;s get on business..<br />
<span id="more-171"></span><br />
In our Base class we are going to add some protected variables (they are going to be viewed from all delivered classes, and from the Base itself)<br />
In our case we add a constructor that creates a mysqli connection to our host, and that&#8217;s all we are going to use this class for - for the connection with the DataBase.</p>
<p>Class Base {<br />
    protected $host = &#8220;localhost&#8221;;<br />
    protected $user = &#8220;root&#8221;;<br />
    protected $pass = &#8220;&#8221;;<br />
    protected $name = &#8220;MerchantsDB;<br />
    protected $char = &#8220;utf-8&#8243;;<br />
    protected $table = &#8220;merchants&#8221;;</p>
<p>		function __construct(){<br />
		if(($this->link = new mysqli($this->host, $this->user, $this->pass, $this->name)) === false){ $this->error(&#8221;cant login&#8221;);</p>
<p>      }else{<br />
		  //echo &#8220;logged<br />&#8220;;<br />
         $this->link->set_charset($this->char) or $this->error(&#8221;set charset&#8221;);</p>
<p>		}<br />
	}<br />
}</p>
<p><?php</p>
<p>Class Merchant extends Base {</p>
<p>    function AddMerchant($mName, $mURL, $mAgent, $mUID, $mDate, $mManager, $mStatus, $mComment){</p>
<p>     $q = mysqli_query($this->link, &#8220;INSERT INTO &#8220;.$this->table.&#8221; (`MerchantName`, `MerchantURL`, `MerchantAgent`, `MerchantUserID`, `MerchantReceivedDate`, `MerchantManager`, `MerchantStatus`, `MerchantComment`) VALUES (&#8217;$mName&#8217;, &#8216;$mURL&#8217;, &#8216;$mAgent&#8217;, &#8216;$mUID&#8217;, &#8216;$mDate&#8217;, &#8216;$mManager&#8217;, &#8216;$mStatus&#8217;, &#8216;$mComment&#8217;)&#8221;);</p>
<p>      if($q){<br />
      	 echo &#8220;Merchant Successfully added !!&#8221;;<br />
      	return true;<br />
      }else{<br />
      	 echo &#8220;Invalid input data or duplicated URL !!&#8221;;<br />
      	return false;<br />
      }</p>
<p>    }</p>
<p>	function RemoveByID($id){<br />
			if(mysqli_query($this->link,&#8221;Delete from &#8220;.$this->table.&#8221; where MerchantID = &#8220;.$id)){<br />
				//echo &#8220;entry $id successfully removed&#8221;;<br />
			}<br />
		}<br />
	}</p>
<p>    function GetAll($order){<br />
      $q = mysqli_query($this->link,&#8221;select * from &#8220;.$this->table.&#8221; ORDER BY &#8220;.$order.&#8221; desc&#8221;);<br />
      $count = 1;</p>
<p>          while($row = mysqli_fetch_assoc($q)){<br />
			include(&#8221;Merchants.table.inc.php&#8221;);</p>
<p>            $count++;<br />
          }<br />
      }</p>
<p>}</p>
<p>So we have a class Merchant that is delivered from Base and so we inherit $link variable from the Base&#8217;s constructor. So when we call $this->link we have a fully working mysqli connection (that is more secure than the standard mysql).</p>
<p>As you see we have created 3 very simple functions of the Merchant class GetAll, RemoveByID, and AddMerchant<br />
in all of them we use $this->link delivered from our base class, which is very cool, because we can have a bunch of other classes - like Product, Car, Student&#8230; whatever and we don&#8217;t have to specify a single connection for each of them - we just inherit it from the Base class - with &#8220;extends Base&#8221; at the class declaration <img src='http://georgi-mitev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>that&#8217;s it for now i hope this example was useful for you <img src='http://georgi-mitev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://georgi-mitev.com/2009/03/30/simple-object-oriented-aspects-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Use local script to login to remote web site (modify Header)</title>
		<link>http://georgi-mitev.com/2009/03/20/login-locally-to-remote-host/</link>
		<comments>http://georgi-mitev.com/2009/03/20/login-locally-to-remote-host/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 07:41:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[CURL]]></category>

		<category><![CDATA[fgets]]></category>

		<category><![CDATA[fputs]]></category>

		<category><![CDATA[fsockopen]]></category>

		<category><![CDATA[Login remotely]]></category>

		<category><![CDATA[PHP modify POST]]></category>

		<guid isPermaLink="false">http://georgi-mitev.com/?p=153</guid>
		<description><![CDATA[I don&#8217;t know if this will be interesting for you, but it was very interesting for me when i found that it is very easy to modify header information and send POST/GET variables through header using php. Anyway with CURL you are able to do much more that just modify the header information etc., but [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t know if this will be interesting for you, but it was very interesting for me when i found that it is very easy to modify header information and send POST/GET variables through header using php. Anyway with CURL you are able to do much more that just modify the header information etc., but we wont have that time-frame <img src='http://georgi-mitev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I will give you simple example where i login through script on localhost on some site - in this example: &#8220;gametrailers.com&#8221; - without actually enter any username and password :), i think this will be the easiest way to understand it.</p>
<p>so here is the example:<br />
<span id="more-153"></span></p>
<p>on your localhost create php file - &#8220;loadUrl.php&#8221;</p>
<p>&lt;base href=&#8221;http://www.gametrailers.com/&#8221; /&gt;<br />
&lt;!&#8211; we use base href to be able to load the css and the js paths correctly on the site &#8211;&gt;</p>
<p>$port = 80;<br />
//usually this is default http port so probably u won&#8217;t have to change this</p>
<p>$server= &#8216;www.gametrailers.com&#8217;;<br />
//i tested thet with this host, but i guess it will work on many other URLs as well</p>
<p>$url = &#8216;/index.php?&#8217;;  //this is the index file of the url</p>
<p>$content = &#8216;userlog&#8217;;<br />
//these are custom variables especially for gametrailers - probably you won&#8217;t have to use them<br />
$content .= &#8216;&amp;try=1&#8242;;<br />
//these are custom variables especially for gametrailers - probably you won&#8217;t have to use them</p>
<p>//enter your site login name<br />
$content .= &#8216;&amp;username=your_username&#8217;;<br />
//enter your site pass<br />
$content .= &#8216;&amp;password=your_pass&#8217;;<br />
$content_length = strlen($content);<br />
//don&#8217;t touch this one - the header has to have valid lenght</p>
<p>$headers = &#8220;POST $url HTTP/1.0\r\n&#8221;;<br />
$headers.= &#8220;Content-type: application/x-www-form-urlencoded\r\n&#8221;;<br />
$headers.= &#8220;Host: $server\r\n&#8221;;<br />
$headers.= &#8220;Content-length: $content_length\r\n\r\n&#8221;;</p>
<p>$fp = fsockopen($server, $port, $errno, $errstr);<br />
//we open connection to our URL<br />
if (!$fp) return false;</p>
<p>fputs($fp, $headers);</p>
<p>fputs($fp, $content);<br />
$ret = &#8220;&#8221;;<br />
while (!feof($fp)) {<br />
$ret.= fgets($fp, 1024);<br />
//we get the content of the URL<br />
}<br />
fclose($fp);</p>
<p>print &#8220;&lt;pre style=&#8221;position:absolute;z-index:100;&#8221;&gt;&#8221;.$ret.&#8221;&lt;/pre&gt;&#8221;;</p>
<p>//we print the actual content of the website, and finally we are logged as user <img src='http://georgi-mitev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
?&gt;</p>
<p>You see - succeed to login on this URL (gametrailers), but on for some other URL you will have to make some more custom solution. For example you will have to check the login form - what are the &#8220;name&#8221; properties for the html input elements, and to change that in the script, but after that everything should be fine <img src='http://georgi-mitev.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://georgi-mitev.com/2009/03/20/login-locally-to-remote-host/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dynamically (on request) Resize Images with PHP</title>
		<link>http://georgi-mitev.com/2009/03/19/resize-image-using-php/</link>
		<comments>http://georgi-mitev.com/2009/03/19/resize-image-using-php/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 07:51:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[cms]]></category>

		<category><![CDATA[joomla]]></category>

		<category><![CDATA[joomla resize image]]></category>

		<category><![CDATA[php resize image]]></category>

		<category><![CDATA[resize image]]></category>

		<category><![CDATA[resize image script]]></category>

		<category><![CDATA[resize script]]></category>

		<guid isPermaLink="false">http://georgi-mitev.com/?p=142</guid>
		<description><![CDATA[Hello  today i&#8217;m going to talk about resizing your the images in your site.
So let&#8217;s say for example that you have a CMS system - like Joomla for example. In the administration you usually have functionality like - uploading images and linking them in your content.
But often the problem with that is that usually [...]]]></description>
			<content:encoded><![CDATA[<p>Hello <img src='http://georgi-mitev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> today i&#8217;m going to talk about resizing your the images in your site.<br />
So let&#8217;s say for example that you have a CMS system - like Joomla for example. In the administration you usually have functionality like - uploading images and linking them in your content.<br />
But often the problem with that is that usually the customers will upload too large images (copied in raw jpeg directly from their cameras) and when they link them to the content of their website, it get&#8217;s really messy.<br />
Anyway you can fix this by writing some script that directly resize the image to some resolution like 500px/* for example, but what will happen if you want to put <a href="http://www.huddletogether.com/projects/lightbox/">lightbox </a>or something other to show the image in large resolution, or you just want to put some function to download the original file etc. You simply can&#8217;t because the image was resized at the moment it was uploaded on the server.</p>
<p><strong>How about dinamically resize the image at the very  moment that client requests it? </strong></p>
<p>So that way we wont have a big image that the client has to download, and at the same time we will still have the original, good resolution copy of the image, in case that we need it. We can also use the following PHP script for creating thumbnails.</p>
<p>Well - as you will see below it&#8217;s not hard at all to do it,  i mean not hard at all <img src='http://georgi-mitev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><span id="more-142"></span>So what we are about to do is create a PHP file that we are going to use for resize of the image.</p>
<p>We are going to pass the images to it like $_GET parameters, for example:</p>
<p>resizeImage.php?image=/images/file.jpg</p>
<p>and the image on our site will look like &lt;img src=&#8221;resizeImage.php?image=/images/file.jpg&#8221; alt=&#8221;#&#8221; /&gt;</p>
<p>so let&#8217;s get to the script:<br />
filename: resizeImage.php<br />
<code>$f = htmlspecialchars($_GET['image']);</code></p>
<p>$im = imagecreatefromjpeg($f);<br />
//we create the image from the $_GET path<br />
$a  = getimagesize($f);</p>
<p>$newwidth = 400;<br />
//we decide to make the picture 400px width and depends on the width/height ratio we calculate what should be the height<br />
if ($a[0] &gt; $a[1]) {<br />
$percentage = $a[0] / $a[1];<br />
$newheight = 400 / $percentage;<br />
} else {<br />
$percentage = $a[1] / $a[0];<br />
$newheight = 400 * $percentage;<br />
}</p>
<p>$d=imagecreatetruecolor($newwidth,$newheight);</p>
<p>imagecopyresized($d, $im, 0, 0, 0, 0, $newwidth, $newheight, $a[0], $a[1]);</p>
<p>header(&#8221;Content-type: image/jpeg&#8221;);<br />
//we modify the header to treat resizeImage.php as image </p>
<p>imagejpeg($d, null, 90 );<br />
//here we show our modified image at quality 90</p>
<p>imagedestroy($im);<br />
//we free the memory (not necessary, but it&#8217;s good practic)<br />
imagedestroy($d);<br />
?&gt;</p>
<p>So that&#8217;s about it <img src='http://georgi-mitev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> I hope it was useful for you.<br />
Anyway i wrote another script that replaces all the content from your site ( for example joomla site)<br />
and basically does the following: when we have <img src="file.jpg" alt="" /> it uses regular expression to replace it like this <img src="imageResize.php?img=file.jpg" alt="" /> and basically it does all the work for you with the replacing <img src='http://georgi-mitev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
if you need it i can post it here as well <img src='http://georgi-mitev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>have a nice one -)</p>
]]></content:encoded>
			<wfw:commentRss>http://georgi-mitev.com/2009/03/19/resize-image-using-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Alien Hominid &#124; flash arcade game</title>
		<link>http://georgi-mitev.com/2009/03/12/alien-booya-flash-game-arcade/</link>
		<comments>http://georgi-mitev.com/2009/03/12/alien-booya-flash-game-arcade/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 23:38:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Games]]></category>

		<category><![CDATA[alien]]></category>

		<category><![CDATA[alien booya]]></category>

		<category><![CDATA[arcade]]></category>

		<category><![CDATA[flash game]]></category>

		<category><![CDATA[games]]></category>

		<category><![CDATA[metal gear]]></category>

		<category><![CDATA[metal gear alternative]]></category>

		<category><![CDATA[nice game]]></category>

		<category><![CDATA[shoot]]></category>

		<category><![CDATA[shooting game]]></category>

		<guid isPermaLink="false">http://georgi-mitev.com/?p=135</guid>
		<description><![CDATA[This is metal gear solid kind-a game W. i highly recommend it if you have&#8217;nt tried it before. You come in the role of the bad alien  that kills FBI agents, and in the same time unknown why you must have to kill all sorts of weird robots etc. This is very classic game [...]]]></description>
			<content:encoded><![CDATA[<p>This is metal gear solid kind-a game W. i highly recommend it if you have&#8217;nt tried it before. You come in the role of the bad alien  that kills FBI agents, and in the same time unknown why you must have to kill all sorts of weird robots etc. This is very classic game so don&#8217;t miss it ;D</p>
<p><a rel="lightbox" href="http://georgi-mitev.com/images/posts/3.2009/alien.jpg"><img src="http://georgi-mitev.com/images/posts/3.2009/alien.jpg" alt="alien arcade flash game" width="50%" height="50%" /></a></p>
<p>if you want to play the game - click <strong>Continue reading</strong></p>
<p><span id="more-135"></span></p>
<p><!--<br />
<object width="550" height="400" data="http://georgi-mitev.com/files/games/alien_booya.swf" type="application/x-shockwave-flash"><param name="src" value="http://georgi-mitev.com/files/games/alien_booya.swf" /></object> &#8211;></p>
]]></content:encoded>
			<wfw:commentRss>http://georgi-mitev.com/2009/03/12/alien-booya-flash-game-arcade/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Windows 7 Visual Studio Funny Bug</title>
		<link>http://georgi-mitev.com/2009/03/11/windows-7-visual-studio-funny-bug/</link>
		<comments>http://georgi-mitev.com/2009/03/11/windows-7-visual-studio-funny-bug/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 20:37:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Fun]]></category>

		<category><![CDATA[Windows Environment]]></category>

		<category><![CDATA[bugs]]></category>

		<category><![CDATA[win7 bug]]></category>

		<category><![CDATA[windows7]]></category>

		<guid isPermaLink="false">http://georgi-mitev.com/?p=130</guid>
		<description><![CDATA[Hello :),
these days i was making a lot of compliments about Windows 7, i was telling my friends how fast and stable it is, even that it&#8217;s still in Beta :). Well i think that it is double as fast compared to Vista, double as stable, double &#8230;. blablabla
&#8230; and also you have double the [...]]]></description>
			<content:encoded><![CDATA[<p>Hello :),<br />
these days i was making a lot of compliments about Windows 7, i was telling my friends how fast and stable it is, even that it&#8217;s still in Beta :). Well i think that it is double as fast compared to Vista, double as stable, double &#8230;. blablabla<br />
&#8230; and also you have double the toolbars, double the menu items double everything <img src='http://georgi-mitev.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
<a href="http://georgi-mitev.com/images/posts/3.2009/win7.jpg" rel="lightbox"><img src="http://georgi-mitev.com/images/posts/3.2009/win7.jpg" width="50%" height="50%" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://georgi-mitev.com/2009/03/11/windows-7-visual-studio-funny-bug/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Shibaku - some realy smart and logical japanese game</title>
		<link>http://georgi-mitev.com/2009/03/11/shibaku-some-realy-smart-and-logical-japanese-game/</link>
		<comments>http://georgi-mitev.com/2009/03/11/shibaku-some-realy-smart-and-logical-japanese-game/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 19:16:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Fun]]></category>

		<category><![CDATA[Games]]></category>

		<category><![CDATA[cool]]></category>

		<category><![CDATA[game]]></category>

		<category><![CDATA[japanese]]></category>

		<category><![CDATA[logical]]></category>

		<category><![CDATA[smart]]></category>

		<category><![CDATA[thinking]]></category>

		<guid isPermaLink="false">http://georgi-mitev.com/?p=119</guid>
		<description><![CDATA[
If you see the image first - u will probably think - oh no  this is some kind of sims flash game, or something like tycoon game where i have to build things and make money etc.
Nothing like that - Shibaku can&#8217;t be compared to any other game - in shibaku you can decide [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://georgi-mitev.com/images/posts/3.2009/shibaku.jpg" rel="lightbox"><img src="http://georgi-mitev.com/images/posts/3.2009/shibaku.jpg" alt="shibaku" width="435" height="306" /></a></p>
<p>If you see the image first - u will probably think - oh no  this is some kind of sims flash game, or something like tycoon game where i have to build things and make money etc.</p>
<p>Nothing like that - Shibaku can&#8217;t be compared to any other game - in shibaku you can decide which technologies to develop more than others, and from that point on you have dozens of different scenarios in which the game will develop. Anyway if you choose good way to develop and grow your town you can get to level 10 and beat the game - unfortunately i just got to level 9 after million different scenarios <img src='http://georgi-mitev.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> Just give it a try - u won&#8217;t regret it <img src='http://georgi-mitev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> -<strong> To play the game click the - &#8220;Continue reading&#8221; button </strong>.</p>
<p><span id="more-119"></span><br />
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="755" height="600"><param name="movie" value="http://georgi-mitev.com/files/games/shibaku.swf"><embed src="http://georgi-mitev.com/files/games/shibaku.swf" width="755" height="600"  pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://georgi-mitev.com/2009/03/11/shibaku-some-realy-smart-and-logical-japanese-game/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Nice crazy game &#124; cool arcade  flash</title>
		<link>http://georgi-mitev.com/2009/03/10/nice-arcade-game-to-relax-or-to-get-nervous/</link>
		<comments>http://georgi-mitev.com/2009/03/10/nice-arcade-game-to-relax-or-to-get-nervous/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 21:06:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Games]]></category>

		<category><![CDATA[cool]]></category>

		<category><![CDATA[flash]]></category>

		<category><![CDATA[free]]></category>

		<category><![CDATA[game]]></category>

		<category><![CDATA[nice]]></category>

		<guid isPermaLink="false">http://georgi-mitev.com/?p=111</guid>
		<description><![CDATA[
Long time ago i found that amazing flash game. I managed to get to level 8. I dunno if someone ever beaten this game - btw this game will be harder for u if ur computer is faster cuz it will run like hell on the later levels 
Click on &#8220;Continue Reading&#8221; to play the [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="lightbox" href="http://georgi-mitev.com/images/posts/3.2009/tunnel.jpg"><img src="http://georgi-mitev.com/images/posts/3.2009/tunnel.jpg" alt="tunnel flash game" /></a><br />
Long time ago i found that amazing flash game. I managed to get to level 8. I dunno if someone ever beaten this game - btw this game will be harder for u if ur computer is faster cuz it will run like hell on the later levels <img src='http://georgi-mitev.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
<strong>Click on &#8220;Continue Reading&#8221; to play the game</strong></p>
<p><span id="more-111"></span></p>
<p><object width="550" height="400" type="application/x-shockwave-flash"></object></p>
<p><object width="550" height="400" data="http://georgi-mitev.com/files/games/tunnel.swf" type="application/x-shockwave-flash"><param name="src" value="http://georgi-mitev.com/files/games/tunnel.swf" /></object></p>
]]></content:encoded>
			<wfw:commentRss>http://georgi-mitev.com/2009/03/10/nice-arcade-game-to-relax-or-to-get-nervous/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
