<?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>SamplePhpCodes.com &#187; Attractive PHP Codes</title>
	<atom:link href="http://www.samplephpcodes.com/category/attractive-php-codes/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.samplephpcodes.com</link>
	<description>Get PHP Code Help, Sample PHP Scripts,PHP Script Demos</description>
	<lastBuildDate>Mon, 05 Apr 2010 15:39:43 +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 script to Send Free SMS through mycantos</title>
		<link>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/php-script-to-send-free-sms-through-mycantos/</link>
		<comments>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/php-script-to-send-free-sms-through-mycantos/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 08:47:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Attractive PHP Codes]]></category>
		<category><![CDATA[SMS Scripts]]></category>
		<category><![CDATA[Useful Codes]]></category>
		<category><![CDATA[free instant sms]]></category>
		<category><![CDATA[free sms php script]]></category>
		<category><![CDATA[free sms sender]]></category>
		<category><![CDATA[send sms api]]></category>
		<category><![CDATA[send sms php script]]></category>

		<guid isPermaLink="false">http://samplephpcodes.com/?p=127</guid>
		<description><![CDATA[This script will help you to sent free sms using your php code. The basic needs for using this code are the following 1. Need to have Internet connection. 2. PHP with curl support. 3. Need to have an account in mycantos.com 4. Create file named ‘cookie.txt’ in the same directory where you are going [...]]]></description>
			<content:encoded><![CDATA[<p>This script will help you to sent free sms using your php code. The basic needs for using this code are the following<br />
<strong></strong><br />
                  1. Need to have Internet connection.<br />
<strong></strong><br />
                  2. PHP with curl support.<br />
<strong></strong><br />
                  3. Need to have an account in mycantos.com<br />
<strong></strong><br />
                  4. Create file named ‘cookie.txt’ in the same directory where you are going to deploy the script with write permission.<br />
<strong></strong><br />
After that copy the code and replace the $uid with your mycantos username, $pwd with your mycantos password , $msg with the message you need to send and $p with the mobile number to which you need to send the sms. Now you are ready to use the script Start sending sms to your dear nd near and Enjoy <img src='http://www.samplephpcodes.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  .</p>
<pre class="brush: php;">&lt;?php

flush();

	$curl = curl_init();

	$timeout = 30;

	$ret = &quot;&quot;;

        $uid='YOUR USERNAME';

        $pwd='YOUR PASSWORD';

	$uid = urlencode($uid);

	$pwd = urlencode($pwd);

	$msg=&quot;YOUR MESSAGE&quot;;

		$p='RECIPIENT PHONE NUMBER';

 		$p = urlencode($p);

		$msg = urlencode($msg);

	curl_setopt ($curl, CURLOPT_URL, &quot;http://www.mycantos.com/redirect.php&quot;);

	curl_setopt ($curl, CURLOPT_POST, 1);

	curl_setopt ($curl, CURLOPT_POSTFIELDS, &quot;username=&quot; . $uid . &quot;&amp;password=&quot; . $pwd . &quot;&amp;checklogin=1&quot;);

	curl_setopt ($curl, CURLOPT_FOLLOWLOCATION, 1);

	curl_setopt ($curl, CURLOPT_COOKIEJAR, 'cookie.txt');

	curl_setopt ($curl, CURLOPT_MAXREDIRS, 20);

	curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);

	curl_setopt ($curl, CURLOPT_USERAGENT, &quot;Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5&quot;);

	curl_setopt ($curl, CURLOPT_CONNECTTIMEOUT, $timeout);

	curl_setopt ($curl, CURLOPT_REFERER, &quot;http://wwwd.mycantos.com/&quot;);

	$text = curl_exec($curl);

	curl_close($curl);

	$cr = curl_init(&quot;http://wwwd.mycantos.com/myAccount.php&quot;);

	curl_setopt($cr, CURLOPT_RETURNTRANSFER, true);        // Get returned value as string (don’t put to screen)

	curl_setopt($cr, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // Spoof the user agent

	curl_setopt ($cr, CURLOPT_COOKIEJAR, 'cookie.txt');

	curl_setopt($cr, CURLOPT_COOKIEFILE, &quot;cookie.txt&quot;); // Use cookie.txt for READING cookies

	$output = curl_exec($cr);

	curl_close($cr);

	//echo $output; 

	$cr = curl_init(&quot;http://wwwd.mycantos.com/sendSMS.php&quot;);

	curl_setopt($cr, CURLOPT_RETURNTRANSFER, true);        // Get returned value as string (don’t put to screen)

	curl_setopt($cr, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // Spoof the user agent

	curl_setopt($cr, CURLOPT_COOKIEFILE, &quot;cookie.txt&quot;); // Use cookie.txt for READING cookies

	curl_setopt ($cr, CURLOPT_COOKIEJAR, 'cookie.txt');

	$output = curl_exec($cr);

	//echo $output;

	curl_close($cr);

	$curl = curl_init();

	curl_setopt ($curl, CURLOPT_URL, &quot;http://www.mycantos.com/sendSMStoanyone.php&quot;);

	curl_setopt ($curl, CURLOPT_POST, 1);

	curl_setopt ($curl, CURLOPT_POSTFIELDS, &quot;checkSMS=1&amp;SMSnumber=&quot; . $p . &quot;&amp;SMSmessage=&quot; . $msg);

	curl_setopt ($curl, CURLOPT_FOLLOWLOCATION, 1);

	curl_setopt ($curl, CURLOPT_COOKIEFILE, &quot;cookie.txt&quot;);

	curl_setopt ($curl, CURLOPT_COOKIEJAR, 'cookie.txt');

	curl_setopt ($curl, CURLOPT_MAXREDIRS, 20);

	curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);

	curl_setopt ($curl, CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);

	curl_setopt ($curl, CURLOPT_CONNECTTIMEOUT, $timeout);

	curl_setopt ($curl, CURLOPT_REFERER, &quot;http://wwwd.mycantos.com/sendSMS.php&quot;);

	$text = curl_exec($curl);

	echo $text;

	curl_close($curl);

?&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/php-script-to-send-free-sms-through-mycantos/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Get Title And Meta Keywords from Any Site With PHP</title>
		<link>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/get-title-and-meta-keywords-from-any-site-with-php/</link>
		<comments>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/get-title-and-meta-keywords-from-any-site-with-php/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 09:43:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Useful Codes]]></category>
		<category><![CDATA[Website SEO Details]]></category>
		<category><![CDATA[fetch site title and keywords]]></category>
		<category><![CDATA[meta description]]></category>
		<category><![CDATA[meta keywords]]></category>
		<category><![CDATA[script to retrieve title and meta data]]></category>
		<category><![CDATA[seo meta data]]></category>
		<category><![CDATA[site metadata]]></category>
		<category><![CDATA[site title]]></category>

		<guid isPermaLink="false">http://samplephpcodes.com/?p=134</guid>
		<description><![CDATA[This code will help you to grab website title and meta keywords and meta description from any site. &#60;?php function getUrlData($url) { $result = false; $contents = getUrlContents($url); if (isset($contents) &#38;&#38; is_string($contents)) { $title = null; $metaTags = null; preg_match('/&#60;title&#62;([^&#62;]*)&#60;\/title&#62;/si', $contents, $match ); if (isset($match) &#38;&#38; is_array($match) &#38;&#38; count($match) &#62; 0) { $title = strip_tags($match[1]); [...]]]></description>
			<content:encoded><![CDATA[<p>This code will help you to grab website title and meta keywords and meta description from any site.<br />
<strong></strong></p>
<pre class="brush: php;">&lt;?php
function getUrlData($url)
{
    $result = false;

    $contents = getUrlContents($url);

    if (isset($contents) &amp;&amp; is_string($contents))
    {
        $title = null;
        $metaTags = null;

        preg_match('/&lt;title&gt;([^&gt;]*)&lt;\/title&gt;/si', $contents, $match );

        if (isset($match) &amp;&amp; is_array($match) &amp;&amp; count($match) &gt; 0)
        {
            $title = strip_tags($match[1]);
        }

       preg_match_all('/&lt;[\s]*meta[\s]*name=&quot;?' . '([^&gt;&quot;]*)&quot;?[\s]*' .'[lang=&quot;]*[^&gt;&quot;]*[&quot;]*'.'[\s]*content=&quot;?([^&gt;&quot;]*)&quot;?[\s]*[\/]?[\s]*&gt;/si', $contents, $match);
        if (isset($match) &amp;&amp; is_array($match) &amp;&amp; count($match) == 3)
        {
            $originals = $match[0];
            $names = $match[1];
            $values = $match[2];

            if (count($originals) == count($names) &amp;&amp; count($names) == count($values))
            {
                $metaTags = array();

                for ($i=0, $limiti=count($names); $i &lt; $limiti; $i++)
                {
		    $metaname=strtolower($names[$i]);
			$metaname=str_replace(&quot;'&quot;,'',$metaname);
			$metaname=str_replace(&quot;/&quot;,'',$metaname);
                        $metaTags[$metaname] = array (
                        'html' =&gt; htmlentities($originals[$i]),
                        'value' =&gt; $values[$i]
                    );
                }
            }
        }
	if(sizeof($metaTags)==0) {
	preg_match_all('/&lt;[\s]*meta[\s]*content=&quot;?' . '([^&gt;&quot;]*)&quot;?[\s]*' .'[lang=&quot;]*[^&gt;&quot;]*[&quot;]*'.'[\s]*name=&quot;?([^&gt;&quot;]*)&quot;?[\s]*[\/]?[\s]*&gt;/si', $contents, $match);

	    if (isset($match) &amp;&amp; is_array($match) &amp;&amp; count($match) == 3)
        {
            $originals = $match[0];
            $names = $match[2];
            $values = $match[1];

            if (count($originals) == count($names) &amp;&amp; count($names) == count($values))
            {
                $metaTags = array();

                for ($i=0, $limiti=count($names); $i &lt; $limiti; $i++)
                {
		    $metaname=strtolower($names[$i]);
			$metaname=str_replace(&quot;'&quot;,'',$metaname);
			$metaname=str_replace(&quot;/&quot;,'',$metaname);
                    $metaTags[$metaname] = array (
                        'html' =&gt; htmlentities($originals[$i]),
                        'value' =&gt; $values[$i]
                    );
                }
            }
        }

	}

        $result = array (
            'title' =&gt; $title,
            'metaTags' =&gt; $metaTags
        );
    }

    return $result;
}
function getUrlContents($url, $maximumRedirections = null, $currentRedirection = 0)
{
    $result = false;
   //global $contents;
    $contents = @file_get_contents($url);

    // Check if we need to go somewhere else

    if (isset($contents) &amp;&amp; is_string($contents))
    {
        preg_match_all('/&lt;[\s]*meta[\s]*http-equiv=&quot;?REFRESH&quot;?' . '[\s]*content=&quot;?[0-9]*;[\s]*URL[\s]*=[\s]*([^&gt;&quot;]*)&quot;?' . '[\s]*[\/]?[\s]*&gt;/si', $contents, $match);

        if (isset($match) &amp;&amp; is_array($match) &amp;&amp; count($match) == 2 &amp;&amp; count($match[1]) == 1)
        {
            if (!isset($maximumRedirections) || $currentRedirection &lt; $maximumRedirections)
            {
                return getUrlContents($match[1][0], $maximumRedirections, ++$currentRedirection);
            }

            $result = false;
        }
        else
        {
            $result = $contents;
        }
    }

    return $contents;
}
?&gt;
//------------------Usage--------------------------------
$Domain='http://www.samplephpcodes.com'; // website
$result = getUrlData($Domain);
if($result['title']==&quot;&quot;) {
$title=&quot;No Data Available&quot;;
} else {
$title=$result['title'];
}
if($result['metaTags']['description']['value']==&quot;&quot;) {
$description=&quot;No Data Available&quot;;
} else {
$description=$result['metaTags']['description']['value'];
}
if($result['metaTags']['keywords']['value']==&quot;&quot;) {
$keywords=&quot;No Data Available&quot;;
} else {
$keywords=$result['metaTags']['keywords']['value'];
}
echo '&lt;br&gt;Title - '.$title;
echo '&lt;br&gt;Description - '.$description;
echo '&lt;br&gt;Keywords - '.$keywords;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/get-title-and-meta-keywords-from-any-site-with-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Find Out All Links In any Website using PHP</title>
		<link>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/find-out-all-links-in-any-website-using-php/</link>
		<comments>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/find-out-all-links-in-any-website-using-php/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 10:31:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Useful Codes]]></category>
		<category><![CDATA[Website SEO Details]]></category>
		<category><![CDATA[free inbound links]]></category>
		<category><![CDATA[inbound links checker]]></category>
		<category><![CDATA[outbound links checker]]></category>
		<category><![CDATA[php script to find inbound links]]></category>
		<category><![CDATA[php url to link]]></category>
		<category><![CDATA[seo outbound links]]></category>
		<category><![CDATA[tracking outbound links]]></category>

		<guid isPermaLink="false">http://samplephpcodes.com/?p=140</guid>
		<description><![CDATA[Thsi little script will help you to find out all the links in any website ( You can even select a particular page of a website ). You can even use this script to find out the number of inbound links, number of outbound links etc present in a site.You can make slight modification to [...]]]></description>
			<content:encoded><![CDATA[<p>Thsi little script will help you to find out all the links in any website ( You can even select a particular page of a website ). You can even use this script to find out the number of inbound links, number of outbound links etc present in a site.You can make slight modification to this code to display all the Links present in a webpage<strong></strong><br />
Inbound link &#8211; link to the same website may be to other pages.<strong></strong><br />
Outnound links &#8211; Links To other web Pages<strong></strong></p>
<pre class="brush: php;">&lt;?php
function getinboundLinks($domain_name) {
ini_set('user_agent', 'NameOfAgent (http://localhost)');
 $url = $domain_name;
$url_without_www=str_replace('http://','',$url);
$url_without_www=str_replace('www.','',$url_without_www);
 $url_without_www= str_replace(strstr($url_without_www,'/'),'',$url_without_www);
$url_without_www=trim($url_without_www);
$input = @file_get_contents($url) or die('Could not access file: $url');
 $regexp = &quot;&lt;a\s[^&gt;]*href=(\&quot;??)([^\&quot; &gt;]*?)\\1[^&gt;]*&gt;(.*)&lt;\/a&gt;&quot;;
//$inbound=0;
$outbound=0;
$nonfollow=0;
if(preg_match_all(&quot;/$regexp/siU&quot;, $input, $matches, PREG_SET_ORDER)) {
foreach($matches as $match) {
# $match[2] = link address
 # $match[3] = link text
//echo $match[3].'&lt;br&gt;';
if(!empty($match[2]) &amp;&amp; !empty($match[3])) {
if(strstr(strtolower($match[2]),'URL:') || strstr(strtolower($match[2]),'url:') ) {
$nonfollow +=1;
} else if (strstr(strtolower($match[2]),$url_without_www) || !strstr(strtolower($match[2]),'http://')) {
     $inbound += 1;
	echo '&lt;br&gt;inbound '. $match[2];
 }
else if (!strstr(strtolower($match[2]),$url_without_www) &amp;&amp; strstr(strtolower($match[2]),'http://')) {
echo '&lt;br&gt;outbound '. $match[2];
     $outbound += 1;
    }
}
}
}
$links['inbound']=$inbound;
$links['outbound']=$outbound;
$links['nonfollow']=$nonfollow;
return $links;
}

// ************************Usage********************************
$Domain='http://www.samplephpcodes.com';
$links=getinboundLinks($Domain);
echo '&lt;br&gt;Number of inbound Links '.$links['inbound'];
echo '&lt;br&gt;Number of outbound Links '.$links['outbound'];
echo '&lt;br&gt;Number of Nonfollow Links '.$links['nonfollow'];
?&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/find-out-all-links-in-any-website-using-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP IP Geographic Location Info</title>
		<link>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/php-ip-geographic-location-info/</link>
		<comments>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/php-ip-geographic-location-info/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 11:10:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Attractive PHP Codes]]></category>
		<category><![CDATA[Useful Codes]]></category>
		<category><![CDATA[ip address locator]]></category>
		<category><![CDATA[ip details ip location location]]></category>
		<category><![CDATA[php ip location lookup]]></category>
		<category><![CDATA[php ip location script]]></category>
		<category><![CDATA[salat ip location location  php classes]]></category>

		<guid isPermaLink="false">http://samplephpcodes.com/?p=148</guid>
		<description><![CDATA[You can use this code for display the loaction details of a perticluar ip address or a Server or a website. This code is taken form www.ipinfodb.com and modified for better results. Just include the following class and create an object and get the corresponding values. &#60;?php class IPDetails{ var $ip; var $countryName; var $countryCode; [...]]]></description>
			<content:encoded><![CDATA[<p>You can use this code for display the loaction details of a perticluar ip address or a Server or a website.<br />
This code is taken form www.ipinfodb.com and modified for better results. Just include the following class and create an object and get the corresponding values.</p>
<pre class="brush: php;">
&lt;?php

class IPDetails{
	var $ip;
	var $countryName;
	var $countryCode;
	var $status;
	var $regionCode;
	var $regionName;
	var $city;
	var $zip;
	var $latitude;
	var $longitude;
	var $gmtOffset;
	var $dstOffset;
	var $timezone;

	function collectIPDetails($ip){
		//$proxy = &quot;74.125.45.100&quot;;
		$addr = &quot;http://www.ipinfodb.com/ip_query.php?ip=&quot;.$ip;

		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $addr);
		//curl_setopt($ch, CURLOPT_PROXY, $proxy);
		curl_setopt($ch, CURLOPT_HEADER, 1);
		curl_setopt($ch, CURLOPT_HTTPGET,1);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
		curl_setopt($ch, CURLOPT_HEADER, FALSE);
		curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
		curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
		curl_setopt($ch, CURLOPT_TIMEOUT,10);
		$pg = curl_exec($ch);
		//echo $pg;
		if($pg){
			$data = new SimpleXMLElement($pg);
			$this-&gt;ip = $data-&gt;Ip;
			$this-&gt;countryName = $data-&gt;CountryName;
			$this-&gt;countryCode = $data-&gt;CountryCode;
			$this-&gt;status = $data-&gt;Status;
			$this-&gt;regionCode = $data-&gt;RegionCode;
			$this-&gt;regionName = $data-&gt;RegionName;
			$this-&gt;city = $data-&gt;City;
			$this-&gt;zip = $data-&gt;ZipPostalCode;
			$this-&gt;latitude = $data-&gt;Latitude;
			$this-&gt;timezone= $data-&gt;Timezone;
			$this-&gt;longitude = $data-&gt;Longitude;
			$this-&gt;gmtOffset = $data-&gt;Gmtoffset;
			$this-&gt;dstOffset = $data-&gt;Dstoffset;
			}
	}
}// class ends
?&gt;

&lt;?php 

	$dt=new IPDetails();

	//if(isset($_REQUEST['ip'])){
	$ips = gethostbynamel($_REQUEST['ip']);

echo '&lt;br&gt;&lt;br&gt;&lt;table border=&quot;0&quot;&gt;';
echo '&lt;tr&gt;&lt;td width=&quot;150&quot; align=&quot;center&quot; bgcolor=&quot;#A3EBFF&quot;&gt;Server Name&lt;/td&gt;&lt;td width=&quot;&quot; align=&quot;center&quot; bgcolor=&quot;#A3EBFF&quot;&gt;IP Address&lt;/td&gt;&lt;td width=&quot;150px&quot; align=&quot;center&quot; bgcolor=&quot;#A3EBFF&quot;&gt;Country&lt;/td&gt;&lt;td width=&quot;&quot; align=&quot;center&quot; bgcolor=&quot;#A3EBFF&quot;&gt;Region&lt;/td&gt;&lt;td width=&quot;100&quot; align=&quot;center&quot; bgcolor=&quot;#A3EBFF&quot;&gt;City&lt;/td&gt;&lt;td width=&quot;&quot; align=&quot;center&quot; bgcolor=&quot;#A3EBFF&quot;&gt;ZipCode&lt;/td&gt;&lt;td width=&quot;&quot; align=&quot;center&quot; bgcolor=&quot;#A3EBFF&quot;&gt;Timezone&lt;/td&gt;&lt;td width=&quot;&quot; align=&quot;center&quot; bgcolor=&quot;#A3EBFF&quot;&gt;Latitude&lt;/td&gt;&lt;/tr&gt;';

 if(is_array($ips)){
	    foreach($ips as $ip ){
 		$dt-&gt;collectIPDetails($ip);
		$img=&quot;http://www.selfseo.com/gfx/flags/&quot;.strtolower($dt-&gt;countryCode).&quot;.png&quot;;
		echo '&lt;tr&gt;&lt;td align=&quot;center&quot; bgcolor=&quot;#DCEFFF&quot;&gt;'.gethostbyaddr($ip).'&lt;/td&gt;';
		echo '&lt;td align=&quot;center&quot; bgcolor=&quot;#DCEFFF&quot;&gt;'.$ip.'&lt;/td&gt;';
		echo '&lt;td align=&quot;center&quot; bgcolor=&quot;#DCEFFF&quot;&gt;'.$dt-&gt;countryName.'&amp;nbsp;&lt;img src=&quot;'.$img.'&quot;&gt;&lt;/td&gt;';
		echo '&lt;td align=&quot;center&quot; bgcolor=&quot;#DCEFFF&quot;&gt;'.$dt-&gt;regionName.'&lt;/td&gt;';
		echo '&lt;td align=&quot;center&quot; bgcolor=&quot;#DCEFFF&quot;&gt;'.$dt-&gt;city.'&lt;/td&gt;';
		echo '&lt;td align=&quot;center&quot; bgcolor=&quot;#DCEFFF&quot;&gt;'.$dt-&gt;zip.'&lt;/td&gt;';
		echo '&lt;td align=&quot;center&quot; bgcolor=&quot;#DCEFFF&quot;&gt;'.$dt-&gt;timezone.'&lt;/td&gt;';
		echo '&lt;td align=&quot;center&quot; bgcolor=&quot;#DCEFFF&quot;&gt;('.$dt-&gt;latitude.' , '.$dt-&gt;longitude.')&lt;/td&gt;';
		echo '&lt;/tr&gt;';
		}
	echo '&lt;/tr&gt;&lt;/table&gt;&lt;br&gt;';
  }
}

?&gt;
</pre>
<p>You can view a demo for this codes from  <a href="http://demo.samplephpcodes.com"> <strong>View Demo</strong></a><br />
Postt Ur comments and queries&#8230;. <img src='http://www.samplephpcodes.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/php-ip-geographic-location-info/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP code to find Domains on same ip</title>
		<link>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/php-code-to-find-domains-on-same-ip/</link>
		<comments>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/php-code-to-find-domains-on-same-ip/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 11:14:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Useful Codes]]></category>
		<category><![CDATA[Website SEO Details]]></category>
		<category><![CDATA[find websites same ip]]></category>
		<category><![CDATA[multiple sites one ip]]></category>
		<category><![CDATA[multiple websites one ip]]></category>
		<category><![CDATA[other sites same ip]]></category>

		<guid isPermaLink="false">http://samplephpcodes.com/?p=152</guid>
		<description><![CDATA[This example will show you how to get the list of domain names on same IP. There might be some situations where you want to host your site and may be interested in knowing the other sites hosted on same domain. This code will help you then..,Happy Coding &#8230; &#60;?php function reverseIP($IP) { for($f=0; $f [...]]]></description>
			<content:encoded><![CDATA[<p>This example will show you how to get the list of domain names on same IP. There might be some situations where you want to host your site and may be interested in knowing the other sites hosted on same domain. This code will help you then..,Happy Coding <img src='http://www.samplephpcodes.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> &#8230;</p>
<pre class="brush: php;">&lt;?php

function reverseIP($IP)
{
	for($f=0; $f &lt;= 2; $f++)
	{
		// this will list the results in the first two page...alter the code to get results from more number of pages
		$url='http://www.bing.com/search?q=ip%3A'.$IP.'&amp;amp;first='.$f.'1&amp;amp;FORM=PORE';
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER[‘HTTP_USER_AGENT’]);
		curl_setopt($ch, CURLOPT_REFERER, &quot;http://yahoo.com/&quot;);
		curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 5);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_TIMEOUT, 20); // times out after 15s
		$searchResults= curl_exec($ch);
		curl_close($ch);
		$parsedData=explode(&quot;&lt;li&gt;&quot;,$searchResults);
		$cntArray=count($parsedData);
		for($x=0;$x&lt;$cntArray;$x++)
		{
			if (preg_match('#&lt;cite&gt;(.*?)&lt;/cite&gt;#i',$parsedData[$x], $matches))
			{
				$fullURL[]=$matches[1];
			}
		}

		$cntURL=count($fullURL);

		for($y=0; $y &lt; $cntURL; $y++)
		{
			$result=explode('/',$fullURL[$y]);
			$TLD[]=$result[0];
		}

	}
	$uniqueTLDList=@array_unique($TLD); // we just want the unique domain names
	return $uniqueTLDList;
}
echo '&lt;/li&gt;';
// specify the IP of your interest
$arr=reverseIP('69.162.116.154');
$size=sizeof($arr);
for($i=0;$i&lt;$size;$i++) {
echo $arr[$i].'&lt;br&gt;';
}
?&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/php-code-to-find-domains-on-same-ip/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Google Page Rank For A website</title>
		<link>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/google-page-rank-for-a-website/</link>
		<comments>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/google-page-rank-for-a-website/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 07:26:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Useful Codes]]></category>
		<category><![CDATA[Website SEO Details]]></category>
		<category><![CDATA[check google page rank]]></category>
		<category><![CDATA[find google page rank]]></category>
		<category><![CDATA[google page rank calculator]]></category>
		<category><![CDATA[google page rank download]]></category>
		<category><![CDATA[google page rank tool]]></category>
		<category><![CDATA[Google page rank using PHP]]></category>
		<category><![CDATA[google rank]]></category>
		<category><![CDATA[PR checker]]></category>
		<category><![CDATA[PR checker using PHP]]></category>

		<guid isPermaLink="false">http://www.samplephpcodes.com/?p=179</guid>
		<description><![CDATA[This code can be used to get Google page Rank for a website&#8230; /*Google PageRank interface providing functions for getting and displaying Google PR's. Checksum functions are based on public domain code created by Alex Stapleton, Andy Doctorow, Tarakan, Bill Zeller, and Vijay &#34;Cyberax&#34; Bhatter. Many thanks!*/ &#60;?php function StrToNum($Str, $Check, $Magic) { $Int32Unit = [...]]]></description>
			<content:encoded><![CDATA[<p>This code can be used to get Google page Rank for a website&#8230;</p>
<pre class="brush: php;">/*Google PageRank interface
providing functions for getting and displaying Google PR's. Checksum functions are based
on public domain code created by Alex Stapleton, Andy Doctorow, Tarakan, Bill Zeller, and
Vijay &quot;Cyberax&quot; Bhatter. Many thanks!*/
&lt;?php
      	function StrToNum($Str, $Check, $Magic) {
    $Int32Unit = 4294967296;  // 2^32

    $length = strlen($Str);
    for ($i = 0; $i &lt; $length; $i++) {
        $Check *= $Magic;
        //If the float is beyond the boundaries of integer (usually +/- 2.15e+9 = 2^31),
        //  the result of converting to integer is undefined
        //  refer to http://www.php.net/manual/en/language.types.integer.php
        if ($Check &gt;= $Int32Unit) {
            $Check = ($Check - $Int32Unit * (int) ($Check / $Int32Unit));
            //if the check less than -2^31
            $Check = ($Check &lt; -2147483648) ? ($Check + $Int32Unit) : $Check;
        }
        $Check += ord($Str{$i});
    }
    return $Check;
}
function HashURL($String) {
    $Check1 = StrToNum($String, 0x1505, 0x21);
    $Check2 = StrToNum($String, 0, 0x1003F);

    $Check1 &gt;&gt;= 2;
    $Check1 = (($Check1 &gt;&gt; 4) &amp; 0x3FFFFC0 ) | ($Check1 &amp; 0x3F);
    $Check1 = (($Check1 &gt;&gt; 4) &amp; 0x3FFC00 ) | ($Check1 &amp; 0x3FF);
    $Check1 = (($Check1 &gt;&gt; 4) &amp; 0x3C000 ) | ($Check1 &amp; 0x3FFF);    

    $T1 = (((($Check1 &amp; 0x3C0) &lt;&lt; 4) | ($Check1 &amp; 0x3C)) &lt;&lt;2 ) | ($Check2 &amp; 0xF0F );
    $T2 = (((($Check1 &amp; 0xFFFFC000) &lt;&lt; 4) | ($Check1 &amp; 0x3C00)) &lt;&lt; 0xA) | ($Check2 &amp; 0xF0F0000 );

    return ($T1 | $T2);
}

function CheckHash($Hashnum) {
    $CheckByte = 0;
    $Flag = 0;

    $HashStr = sprintf('%u', $Hashnum) ;
    $length = strlen($HashStr);

    for ($i = $length - 1;  $i &gt;= 0;  $i --) {
        $Re = $HashStr{$i};
        if (1 === ($Flag % 2)) {
            $Re += $Re;
            $Re = (int)($Re / 10) + ($Re % 10);
        }
        $CheckByte += $Re;
        $Flag ++;
    }

    $CheckByte %= 10;
    if (0 !== $CheckByte) {
        $CheckByte = 10 - $CheckByte;
        if (1 === ($Flag % 2) ) {
            if (1 === ($CheckByte % 2)) {
                $CheckByte += 9;
            }
            $CheckByte &gt;&gt;= 1;
        }
    }

    return '7'.$CheckByte.$HashStr;
}
function getch($url) { return CheckHash(HashURL($url)); }
function getpr($url) {
$googlehost='toolbarqueries.google.com';
$googleua='Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5';
    $ch = getch($url);
	$fp = fsockopen($googlehost, 80, $errno, $errstr, 30);
    if ($fp) {
       $out = &quot;GET /search?client=navclient-auto&amp;ch=$ch&amp;features=Rank&amp;q=info:$url HTTP/1.1\r\n&quot;;
       $out .= &quot;User-Agent: $googleua\r\n&quot;;
       $out .= &quot;Host: $googlehost\r\n&quot;;
       $out .= &quot;Connection: Close\r\n\r\n&quot;;
           fwrite($fp, $out);
         while (!feof($fp)) {
            $data = fgets($fp, 128);
            //echo $data;
            $pos = strpos($data, &quot;Rank_&quot;);
            if($pos === false){} else{
                $pr=substr($data, $pos + 9);
                $pr=trim($pr);
                $pr=str_replace(&quot;\n&quot;,'',$pr);
                return $pr;
		//echo $pr;
            }
       }
       //else { echo &quot;$errstr ($errno)&lt;br /&gt;\n&quot;; } //debug only
       fclose($fp);
    }
}
?&gt;
//*********************************** Usage ****************************

echo getpr('samplephpcodes.com');
echo '&lt;a href=&quot;http://www.samplephpcodes.com&quot;&gt;sample php codes&lt;/a&gt;';
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/google-page-rank-for-a-website/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Display Google Page Rank Of a Website as Image</title>
		<link>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/display-google-page-rank-of-a-website-as-image/</link>
		<comments>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/display-google-page-rank-of-a-website-as-image/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 07:40:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Useful Codes]]></category>
		<category><![CDATA[Website SEO Details]]></category>
		<category><![CDATA[check pagerank]]></category>
		<category><![CDATA[google page rank graphical display]]></category>
		<category><![CDATA[page rank php script]]></category>
		<category><![CDATA[php pagerank checker]]></category>
		<category><![CDATA[PR graphical display]]></category>
		<category><![CDATA[pr page rank]]></category>
		<category><![CDATA[seo tools page rank]]></category>

		<guid isPermaLink="false">http://www.samplephpcodes.com/?p=183</guid>
		<description><![CDATA[This code will help you in displaying the google page Rank for any website in the form of image or graphical display. You can even add images of your choice to display them according to the page rank value..Hope This will Help You..Happy Coding&#8230;.. &#60;?php $googlehost='toolbarqueries.google.com'; $googleua='Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 [...]]]></description>
			<content:encoded><![CDATA[<p>This code will help you in displaying the google page Rank for any website in the form of image or graphical display. You can even add images of your choice to display them according to the page rank value..Hope This will Help You..Happy Coding&#8230;..</p>
<pre class="brush: php;">
&lt;?php

      $googlehost='toolbarqueries.google.com';

      $googleua='Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5';

      //convert a string to a 32-bit integer

      function StrToNum($Str, $Check, $Magic) {

          $Int32Unit = 4294967296;  // 2^32

          $length = strlen($Str);

          for ($i = 0; $i &lt; $length; $i++) {

              $Check *= $Magic;

              //If the float is beyond the boundaries of integer (usually +/- 2.15e+9 = 2^31),

              //  the result of converting to integer is undefined

              //  refer to http://www.php.net/manual/en/language.types.integer.php

              if ($Check &gt;= $Int32Unit) {

             $Check = ($Check - $Int32Unit * (int) ($Check / $Int32Unit));

                  //if the check less than -2^31
              $Check = ($Check &lt; -2147483648) ? ($Check + $Int32Unit) : $Check;

              }

              $Check += ord($Str{$i});

          }
      return $Check;

      }

      //genearate a hash for a url

      function HashURL($String) {

          $Check1 = StrToNum($String, 0x1505, 0x21);

          $Check2 = StrToNum($String, 0, 0x1003F);

          $Check1 &gt;&gt;= 2;      

          $Check1 = (($Check1 &gt;&gt; 4) &amp; 0x3FFFFC0 ) | ($Check1 &amp; 0x3F);

          $Check1 = (($Check1 &gt;&gt; 4) &amp; 0x3FFC00 ) | ($Check1 &amp; 0x3FF);

          $Check1 = (($Check1 &gt;&gt; 4) &amp; 0x3C000 ) | ($Check1 &amp; 0x3FFF); 

          $T1 = (((($Check1 &amp; 0x3C0) &lt;&lt; 4) | ($Check1 &amp; 0x3C)) &lt;&lt;2 ) | ($Check2 &amp; 0xF0F );

          $T2 = (((($Check1 &amp; 0xFFFFC000) &lt;&lt; 4) | ($Check1 &amp; 0x3C00)) &lt;&lt; 0xA) | ($Check2 &amp; 0xF0F0000 );

          return ($T1 | $T2);

      }

      //genearate a checksum for the hash string

      function CheckHash($Hashnum) {

          $CheckByte = 0;

          $Flag = 0;

          $HashStr = sprintf('%u', $Hashnum) ;

          $length = strlen($HashStr);

          for ($i = $length - 1;  $i &gt;= 0;  $i --) {

              $Re = $HashStr{$i};

              if (1 === ($Flag % 2)) {              

                  $Re += $Re;    

                  $Re = (int)($Re / 10) + ($Re % 10);

              }

              $CheckByte += $Re;

              $Flag ++;       

          }

          $CheckByte %= 10;

          if (0 !== $CheckByte) {

              $CheckByte = 10 - $CheckByte;

              if (1 === ($Flag % 2) ) {

                  if (1 === ($CheckByte % 2)) {

                      $CheckByte += 9;

                  }

                  $CheckByte &gt;&gt;= 1;

              }

          }

          return '7'.$CheckByte.$HashStr;

      }

      //return the pagerank checksum hash

      function getch($url) { return CheckHash(HashURL($url)); }

      //return the pagerank figure

      function getpr($url) {

              global $googlehost,$googleua;

              $ch = getch($url);

              $fp = fsockopen($googlehost, 80, $errno, $errstr, 30);

              if ($fp) {

                 $out = &quot;GET /search?client=navclient-auto&amp;ch=$ch&amp;features=Rank&amp;q=info:$url HTTP/1.1\r\n&quot;;

                 $out .= &quot;User-Agent: $googleua\r\n&quot;;

                 $out .= &quot;Host: $googlehost\r\n&quot;;

                 $out .= &quot;Connection: Close\r\n\r\n&quot;;

                 fwrite($fp, $out);

                     while (!feof($fp)) {

                              $data = fgets($fp, 128);

                              //echo $data;

                              $pos = strpos($data, &quot;Rank_&quot;);

                              if($pos === false){} else{

                                      $pr=substr($data, $pos + 9);

                                      $pr=trim($pr);

                                      $pr=str_replace(&quot;\n&quot;,'',$pr);

                                      return $pr;

                              }

                 }

                   fclose($fp);

              }

      }

      //generate the graphical pagerank

      function pagerank($url,$width=40,$method='style') {

              if (!preg_match('/^(http:\/\/)?([^\/]+)/i', $url)) { $url='http://'.$url; }

              $pr=getpr($url);

              $pagerank=&quot;PageRank: $pr/10&quot;;

              //The (old) image method

              if ($method == 'image') {

              $prpos=$width*$pr/10;

              $prneg=$width-$prpos;

              $html='&lt;img src=&quot;http://www.google.com/images/pos.gif&quot; width='.$prpos.' height=4 border=0 alt=&quot;'.$pagerank.'&quot;&gt;&lt;img src=&quot;http://www.google.com/images/neg.gif&quot; width='.$prneg.' height=4 border=0 alt=&quot;'.$pagerank.'&quot;&gt;';

              }

              //The pre-styled method

              if ($method == 'style') {

              $prpercent=100*$pr/10;

              $html='&lt;div style=&quot;position: relative; width: '.$width.'px; padding: 0; background: #D9D9D9;&quot;&gt;&lt;strong style=&quot;width: '.$prpercent.'%; display: block; position: relative; background: #5EAA5E; text-align: center; color: #333; height: 4px; line-height: 4px;&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;';

              }

              $out='&lt;a href=&quot;'.$url.'&quot; title=&quot;'.$pagerank.'&quot;&gt;'.$html.'&lt;/a&gt;';

              return $out;

      }

      echo pagerank('www.samplephpcodes.com',40,'image');
 echo ‘&lt;a href=&quot;http://www.samplephpcodes.com&quot;&gt;sample php codes&lt;/a&gt;’;
      ?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.samplephpcodes.com/sample-php-codes/use-full-codes/display-google-page-rank-of-a-website-as-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>way2sms PHP sms script</title>
		<link>http://www.samplephpcodes.com/attractive-php-codes/sms-scripts/way2sms-php-sms-script/</link>
		<comments>http://www.samplephpcodes.com/attractive-php-codes/sms-scripts/way2sms-php-sms-script/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 10:18:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SMS Scripts]]></category>
		<category><![CDATA[free sms script]]></category>
		<category><![CDATA[php sms script]]></category>
		<category><![CDATA[way2sms]]></category>
		<category><![CDATA[way2sms php client]]></category>

		<guid isPermaLink="false">http://www.samplephpcodes.com/?p=359</guid>
		<description><![CDATA[The URL – http://mobile.samplephpcodes.com/sendsms.php – can be invoked with the parameters as follows: http://mobile.samplephpcodes.com/sendsms.php?uid=9933445566&#038;pwd=password&#038;phone= 9812345678;9933445566&#038;msg=Hello+World You can also do a HTTP POST to the same URL to send the SMS. Here’s an example: Create an account on way2sms.com and use that mobile number as userid and password &#60;form method=”post” action=”sendsms.php“&#62; &#60;input type=”hidden” name=”uid” value=”userid(mobile)&#34; /&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>The URL – http://mobile.samplephpcodes.com/sendsms.php – can be invoked with the parameters as follows:</p>
<p>http://mobile.samplephpcodes.com/sendsms.php?uid=9933445566&#038;pwd=password&#038;phone= 9812345678;9933445566&#038;msg=Hello+World</p>
<p>You can also do a HTTP POST to the same URL to send the SMS. Here’s an example:</p>
<p>Create an account on way2sms.com and use that mobile number as userid and password</p>
<pre class="brush: xml;">

    &lt;form method=”post” action=”sendsms.php“&gt;
    &lt;input type=”hidden” name=”uid” value=”userid(mobile)&quot; /&gt;
    &lt;input type=”hidden” name=”pwd” value=”password” /&gt;
    &lt;input type=”hidden” name=”phone” value=”9812345678;9933445566? /&gt;
    &lt;input type=”hidden” name=”msg” value=”Hello World” /&gt;
    &lt;input type=”submit” value=”Send SMS” /&gt;
    &lt;/form&gt;
</pre>
<p>save the following code  as sendsms.php and use the above html post or the url GET method</p>
<pre class="brush: php;">
&lt;?php
	if(!function_exists('stripos'))
	{
		function stripos($haystack, $needle, $offset = 0)
		{
			return strpos(strtolower($haystack), strtolower($needle), $offset);
		}
	}

	if ( isset($_GET['uid']) &amp;&amp; isset($_GET['pwd']) &amp;&amp; isset($_GET['phone']) &amp;&amp; isset($_GET['msg']) )
	{
		echo sendSMSToMany($_GET['uid'], $_GET['pwd'], $_GET['phone'], $_GET['msg']);
		exit;
	}
	else if ( isset($_POST['uid']) &amp;&amp; isset($_POST['pwd']) &amp;&amp; isset($_POST['phone']) &amp;&amp; isset($_POST['msg']) )
	{       $smsg=stripslashes($_POST['msg']);

		echo 'sendSMSToMany('.$_POST['uid'].','. $_POST['pwd'].','. $_POST['phone'].','.$smsg.')';
                echo sendSMSToMany($_POST['uid'], $_POST['pwd'], $_POST['phone'],$smsg);
		exit;
	}

	function sendSMSToMany($uid, $pwd, $phone, $msg)
	{
		$curl = curl_init();
		$timeout = 30;
		$ret = &quot;&quot;;

		$uid = urlencode($uid);
		$pwd = urlencode($pwd);

		curl_setopt ($curl, CURLOPT_URL, &quot;http://wwwd.way2sms.com/auth.cl&quot;);
		curl_setopt ($curl, CURLOPT_POST, 1);
		curl_setopt ($curl, CURLOPT_POSTFIELDS, &quot;username=&quot; . $uid . &quot;&amp;password=&quot; . $pwd . &quot;&amp;q=Deepika%20Padukone%20Photo%20Gallery&amp;Submit=Sign in&quot;);
		curl_setopt ($curl, CURLOPT_COOKIESESSION, 1);
		curl_setopt ($curl, CURLOPT_COOKIEFILE, &quot;cookie_way2sms&quot;);
		curl_setopt ($curl, CURLOPT_FOLLOWLOCATION, 1);
		curl_setopt ($curl, CURLOPT_MAXREDIRS, 20);
		curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt ($curl, CURLOPT_USERAGENT, &quot;Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5&quot;);
		curl_setopt ($curl, CURLOPT_CONNECTTIMEOUT, $timeout);
		curl_setopt ($curl, CURLOPT_REFERER, &quot;http://wwwd.way2sms.com/&quot;);
		$text = curl_exec($curl);

		// Check for proper login
		$pos = stripos(curl_getinfo($curl, CURLINFO_EFFECTIVE_URL), &quot;main.jsp&quot;);
		if ($pos === &quot;FALSE&quot; || $pos == 0 || $pos == &quot;&quot;)
			return &quot;invalid login&quot;;

		if (trim($msg) == &quot;&quot; || strlen($msg) == 0) return &quot;invalid message&quot;;
		$msg = urlencode($msg);
		$pharr = explode(&quot;;&quot;, $phone);
		$refurl = curl_getinfo($curl, CURLINFO_EFFECTIVE_URL);
		curl_setopt ($curl, CURLOPT_REFERER, $refurl);
		curl_setopt ($curl, CURLOPT_URL, &quot;http://wwwd.way2sms.com/jsp/InstantSMS.jsp&quot;);
		$text = curl_exec($curl);

		//echo $text; exit;

		preg_match_all('/&lt;input[\s]*type=&quot;hidden&quot;[\s]*name=&quot;Action&quot;[\s]*value=&quot;?([^&gt;]*)?&quot;/si', $text, $match);

		$action=$match[1][0]; // get custid from the form fro the Action field in the post form

		foreach ($pharr as $p)
		{
			if (strlen($p) != 10 || !is_numeric($p) || strpos($p, &quot;.&quot;) != false)
			{
				$ret .= &quot;invalid number;&quot; . $p . &quot;\n&quot;;
				continue;
			}

			$p = urlencode($p);

			curl_setopt ($curl, CURLOPT_URL, 'http://wwwd.way2sms.com/FirstServletsms?custid=');
			curl_setopt ($curl, CURLOPT_REFERER, curl_getinfo($curl, CURLINFO_EFFECTIVE_URL));
			curl_setopt ($curl, CURLOPT_POST, 1);
			curl_setopt ($curl, CURLOPT_POSTFIELDS, &quot;HiddenAction=instantsms&amp;login=&amp;pass=&amp;custid=undefined&amp;Action=&quot;.$action.&quot;&amp;MobNo=&quot;.$p.&quot;&amp;textArea=&quot;.$msg);
			$contents= curl_exec($curl);
			$_SESSION['count']++;
		}

		curl_setopt ($curl, CURLOPT_URL, &quot;http://wwwd.way2sms.com/jsp/logout.jsp&quot;);
		curl_setopt ($curl, CURLOPT_REFERER, $refurl);
		$text = curl_exec($curl);

		curl_close($curl);

		echo '##'.$contents;
		preg_match_all('/&lt;span class=&quot;style1&quot;&gt;?([^&gt;]*)?&lt;\/span&gt;/si', $contents, $match);

		if(!isset($match[1][0]) || $match[1][0]==&quot;&quot;)
		  echo 'Message can not be submitted';
		else
		  echo $match[1][0];

	}

	if ( file_exists(&quot;nusoap/nusoap.php&quot;) ) {
		require (&quot;nusoap/nusoap.php&quot;);
		if ( !class_exists(&quot;soap_server&quot;) ) {
			printUsage();
		}
	} else {
		printUsage();
	}

	$server = new soap_server();
	$server-&gt;configureWSDL('SendSMS','urn:sms');
	$server-&gt;register(&quot;sendSMSToMany&quot;,
					  array('uid' =&gt; 'xsd:string', 'pwd' =&gt; 'xsd:string', 'phone' =&gt; 'xsd:string', 'msg' =&gt; 'xsd:string'),
					  array('status' =&gt; 'xsd:string'),
					  'urn:SendSMSToMany', 'urn:sms#SendSMSToMany', 'rpc', 'encoded',
					  'Sends the same SMS to multiple phone numbers. Give your 10 digit phone number for user ID. Separate each phone number with a semicolon(\';\').');
	$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
	$server-&gt;service($HTTP_RAW_POST_DATA);

	function printUsage() {
		$nl = &quot;\r\n&quot;;
		echo &quot;invalid_request&quot; . $nl;
		//echo &quot;Usage: Refer to http://www.samplephpcodes.com for more informaiton.&quot; . $nl;
		exit;
	}
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.samplephpcodes.com/attractive-php-codes/sms-scripts/way2sms-php-sms-script/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
