> Altså kunne sende diverse headers og modtage en webside retur.
Nedenstående eksempel henter
www.php.net ned, idet den sender et par ekstra
headers. CURL er dog normalt at foretrække den slags ting.
<?php
$fp = fsockopen("
www.php.net", 80, $iErr, $strErr, 30) or die("$strErr
($iErr)");
$arrPut[] = "GET / HTTP/1.1";
$arrPut[] = "Host:
www.php.net";
$arrPut[] = "X-additional headers: X";
$strPut = implode("\r\n", $arrPut) . "\r\n\r\n";
fwrite($fp, $strPut, strlen($strPut));
$buf = (string) "";
while(!feof($fp)) {
$buf .= fread($fp, 128);
}
echo htmlspecialchars($buf);
?>
/A
--
parse_str("a[97]=44d&a[100]=3&a[101]=5e0&a[114]=5&a[115]=57e&a[64]=7&a[106]
=8&a[110]=b91d12&a[111]=775&a[104]=a&a[46]=11&a[99]=12&a[109]=14") or $str=
str_repeat(" ",20);foreach($a as$x=>$y){for($i=0;$i<strlen(hexdec($y));$i+=
2){$str=substr_replace($str,chr($x),substr(hexdec($y),$i,2),1);}}print$str;