Selamat Datang

Assalamu'alaikum Warahmatullahi Wabarokatuh Wamaghfiratuh, Moga anda dapat mengambil manfaat dari keberadaan blog Prestasikoe ini.

blog ini sekedar kumpulan" yang tidak bisa ku ingat seluruhnya,
makanya dibuat dlm tulisan.

produk

produk

Saturday, May 31, 2008

baru dwa tulisan

bulan ini baru dwa tulisan

tgl 12 pada datang ke bdg
tgl 13 dirumah aje, gwe kerja da blom ijin
tgl 14 main ke kawah putih, a paradise of the world
tgl 15 pulang kejokja ya...., naik tut tut
tgl 17 paket chip
tgl 19 chipnya nyampe tuh ngak ku buka
tgl 28 balik ke smd ya..
tgl 31 hari tanpa tembakau
see you
iwmu
bg83

Wednesday, May 28, 2008

back to samarinda

hei i,
sore ini jd khan balik ke samarinda
hati" di perjalanan ya!

bg83

cobalagi kirim cv

coba lagi kirim cv a....h
mudah mudahan ktrima
syukur Alhamdulillah klo bisa ktrima

trima ya.. ya...

mkasih bwt bang dendi atas informasinya

bg83

Monday, April 28, 2008

Php Httpredirects

<?php

//http://www.digiways.com/articles/php/httpredirects/

class CDWHttpFile

{

/* $strLocation - URL of the last web page retreived (could be different

from what was requiested in case of HTTP redirect.) */

var $strLocation;

var $aHeaderLines; // headers of last web page

var $strFile; // last web page retreived

/* $bResult - contains true if last web page was

retrieved successfully, false otherwise. */

var $bResult;

/* ReadHttpFile - the function that does all the work.

$strUrl - URL of the page we want to get.

$iHttpRedirectMaxRecursiveCalls - maximum number of

times following HTTP redirection. */

function ReadHttpFile($strUrl, $iHttpRedirectMaxRecursiveCalls = 20)

{

// parsing the url getting web server name/IP, path and port.

$url = parse_url($strUrl);

// setting path to "/" if not present in $strUrl

if (isset($url["path"]) == false) $url["path"] = "/";

// setting port to default HTTP server port 80

if (isset($url["port"]) == false) $url["port"] = 80;

// connecting to the server

$fp = fsockopen ($url["host"], $url["port"], $errno, $errstr, 30);


// reseting class data

$this->bResult = false;

unset($this->strFile);

unset($this->aHeaderLines);

$this->strLocation = $strUrl;


/* Return if the socket was not open $this->bResult is set to false. */

if (!$fp)

return;

else

{

// composing HTTP request

$strQuery = "GET ".$url["path"];

if (isset($url["query"]) == true) $strQuery .= "?".$url["query"];

$strQuery .= " HTTP/1.0\r\n\r\n";

// sending the request to the server

fputs($fp, $strQuery);

/* $bHeader is set to true while we receive the HTTP header

and after the empty line (end of HTTP header) it's set to false. */

$bHeader = true;

// continuing untill there's no more text to read from the socket

while (!feof($fp))

{

/* reading a line of text from the socket

not more than 8192 symbols. */

$strLine = fgets($fp, 8192);

// removing trailing \n and \r characters.

$strLine = ereg_replace("[\r\n]", "", $strLine);

if ($bHeader == false)

$this->strFile .= $strLine."\n";

else

$this->aHeaderLines[] = trim($strLine);

if (strlen($strLine) == 0) $bHeader = false;

}

fclose ($fp);

}


/* Processing all HTTP header lines and checking for

HTTP redirect directive 'Location:'. */

for ($i = 0; $i < count($this->aHeaderLines); $i++)

if (strcasecmp(substr($this->aHeaderLines[$i], 0, 9), "Location:") == 0)

{

$url = trim(substr($this->aHeaderLines[$i], 9));

// $url now is the URL of the web page we are relocated to

// If $url is the same page we are requesting, just continue

if ($url != $strUrl)

{

/* If the maximum number of redirects is reached,

just return. $this->bResult is set to false. */

if ($iHttpRedirectMaxRecursiveCalls == 0) return;

/* Calling the function recursively with the new URL

and the maximum number of redirections reduced by one. */

return $this->ReadHttpFile(

$url,

$iHttpRedirectMaxRecursiveCalls-1);

}

}


/* We should get here if there was no HTTP redirect directive found.

Setting $this->bResult to true. Web page was retreived successfully. */

$this->bResult = true;



/* If magic_quotes_runtime is enabled in php.ini, then all the quotes

in the received text will be prefixed with slashes. */

if (ini_get("magic_quotes_runtime"))

{

$this->strFile = stripslashes($this->strFile);

for ($i = 0; $i < count($this->aHeaderLines); $i++)

$this->aHeaderLines[$i] = stripslashes($this->aHeaderLines[$i]);

}

}


/* Just to make it easier to use this class, adding contructor

which accepts URL as a parameter and calls ReadHttpFile functions. */

function CDWHttpFile($strUrl = "")

{

if (strlen($strUrl) > 0)

$this->ReadHttpFile($strUrl);

}

};


$httpFile = new CDWHttpFile("http://localhost");

if ($httpFile->bResult == true)

{

echo "URL: $httpFile->strLocation <br>";

foreach($httpFile->aHeaderLines as $strHeaderLine)

echo "Header line: ".htmlspecialchars($strHeaderLine)."<br>";

//echo "Contents: <hr>".htmlspecialchars($httpFile->strFile)."<hr>";

preg_split("/<body>/ || /<\/body><\/html>/",$httpFile->strFile,3);

//echo htmlspecialchars($a[0]);

}


?>




bg83

Php HttpRequest

Ni Aq kasi HttpRequest pake php

biar gampang klo ada crosing data antar server

Scrip ini udah di coba di labnya bageer83

Selamat Mencoba








<?php

error_reporting(E_ALL);

set_time_limit(10);

class HttpRequest

{

var $sHostAdd;

var $sUri;

var $iPort;

var $sPostData;

var $sRequestHeader;

var $sResponse;



function HttpRequest($sUrl)

{

$sPatternUrlPart = '/http:\/\/([a-z-\.0-9]+)(:(\d+)){0,1}(.*)/i';

$arMatchUrlPart = array();

preg_match($sPatternUrlPart, $sUrl, $arMatchUrlPart);



$this->sHostAdd = gethostbyname($arMatchUrlPart[1]);

if (empty($arMatchUrlPart[4]))

{

$this->sUri = '/';

}

else

{

$this->sUri = $arMatchUrlPart[4];

}

if (empty($arMatchUrlPart[3]))

{

$this->iPort = 80;

}

else

{

$this->iPort = $arMatchUrlPart[3];

}



$this->addRequestHeader('Host: '.$arMatchUrlPart[1]);

$this->addRequestHeader('Connection: Close');

}



function addRequestHeader($sHeader)

{

$this->sRequestHeader .= trim($sHeader)."\r\n";

}



function addData($var,$data){

$this->sPostData .= "&"."$var"."=".urlencode("$data");

}



function getData(){

return $this->sPostData;

}



function sendRequest($sMethod = 'GET', $sPostData = '')

{

$sPostData.=$this->getData();

//echo $sPostData;



if ($sMethod == 'GET'){

$sRequest = $sMethod." ".$this->sUri."?".$sPostData." HTTP/1.1\r\n";

}else{

$sRequest = $sMethod." ".$this->sUri." HTTP/1.1\r\n";

}



//$sRequest = $this->sUri." HTTP/1.1\r\n";



$sRequest .= $this->sRequestHeader;

if ($sMethod == 'POST')

{

$sRequest .= "Content-Type: application/x-www-form-urlencoded\r\n";

$sRequest .= "Content-Length: ".strlen($sPostData)."\r\n";

$sRequest .= "\r\n";

$sRequest .= $sPostData."\r\n";

}

$sRequest .= "\r\n";



$sockHttp = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);

if (!$sockHttp)

{

die('socket_create() failed!');

}



$resSockHttp = socket_connect($sockHttp, $this->sHostAdd, $this->iPort);

if (!$resSockHttp)

{

die('socket_connect() failed!');

}



socket_write($sockHttp, $sRequest, strlen($sRequest));



$this->sResponse = '';

while ($sRead = socket_read($sockHttp, 1024))/*4096*/

{

$this->sResponse .= $sRead;

}

socket_close($sockHttp);

}



function getResponse()

{

return $this->sResponse ;

}



function getResponseBody()

{

$sPatternSeperate = '/\r\n\r\n/';

$arMatchResponsePart = preg_split($sPatternSeperate, $this->sResponse,2);

//return $arMatchResponsePart[0];/*header information*/

//return $arMatchResponsePart[1];/*isi data*/

$arMatchResponsePart = preg_split("/\r\n/",$arMatchResponsePart[1],2);/*dibatas 2 partisi*/

$response=substr_replace($arMatchResponsePart[1],"",-5,1);/*menghilangkan end response 0*/

return $response;

}

}

$HttpRequest=new HttpRequest("http://localhost/lab/phpsocket/dataonserver.php");

//$HttpRequest->addRequestHeader("Content-Type: text/html; charset=utf-8");

//$HttpRequest->addRequestHeader("Accept: text/plain");



$HttpRequest->addData("act","smsout");

$HttpRequest->addData("mess","test `~!@#$%^&*()_+|{}:\"<>?-=\[];',./");



$HttpRequest->sendRequest("GET","");

//$HttpRequest->sendRequest("POST","act=".urlencode("testdari send"));



//echo $HttpRequest->getResponse();

echo $HttpRequest->getResponseBody();


bg83