Netwrkengeer
IS-IT--Management
I just wrote some code, and I'm getting an error
Warning: Failed opening '/usr/home/jbh/htdocs/codetest.phtml' for inclusion (include_path='.:/usr/local/lib/php') in /usr/home/jbh/htdocs/pagetest.phtml on line 9
Fatal error: Call to undefined function: codetest() in /usr/home/jbh/htdocs/pagepost.phtml on line 14
/*
this is the pagetest.phtml code
*/
<?php
include("codetest.phtml"
$d["foo"] = "some";
$d["bar"] = "data";
$Result = PostIt($d, "
if (isset($Result["errno"])) {
$errno = $Result["errno"]; $errstr = $Result["errstr"];
echo "<B>Error $errno</B> $errstr";
exit;
}
else {
while (list($key, $val) = each($Result)) echo $val;
}
?>
/*
this is the codetest.phtml code
*/
<?php
function codetest($DataStream, $URL) {
// Strip http:// from the URL if present
$URL = ereg_replace("^ "", $URL);
// Separate into Host and URI
$Host = substr($URL, 0, strpos($URL, "/");
$URI = strstr($URL, "/"
// Form up the request body
$ReqBody = "";
while (list($key, $val) = each($DataStream)) {
if ($ReqBody) $ReqBody.= "&";
$ReqBody.= $key."=".urlencode($val);
}
$ContentLength = strlen($ReqBody);
// Generate the request header
$ReqHeader =
"POST $URI HTTP/1.1\n".
"Host: $Host\n".
"User-Agent: PostIt\n".
"Content-Type: application/x- "Content-Length: $ContentLength\n\n".
"$ReqBody\n";
// Open the connection to the host
$socket = fsockopen($Host, 80, &$errno, &$errstr);
if (!$socket) {
$Result["errno"] = $errno;
$Result["errstr"] = $errstr;
return $Result;
}
$idx = 0;
fputs($socket, $ReqHeader);
while (!feof($socket)) {
$Result[$idx++] = fgets($socket, 128);
}
return $Result;
}
?>
/*
thanks Rob
*/
Warning: Failed opening '/usr/home/jbh/htdocs/codetest.phtml' for inclusion (include_path='.:/usr/local/lib/php') in /usr/home/jbh/htdocs/pagetest.phtml on line 9
Fatal error: Call to undefined function: codetest() in /usr/home/jbh/htdocs/pagepost.phtml on line 14
/*
this is the pagetest.phtml code
*/
<?php
include("codetest.phtml"
$d["foo"] = "some";
$d["bar"] = "data";
$Result = PostIt($d, "
if (isset($Result["errno"])) {
$errno = $Result["errno"]; $errstr = $Result["errstr"];
echo "<B>Error $errno</B> $errstr";
exit;
}
else {
while (list($key, $val) = each($Result)) echo $val;
}
?>
/*
this is the codetest.phtml code
*/
<?php
function codetest($DataStream, $URL) {
// Strip http:// from the URL if present
$URL = ereg_replace("^ "", $URL);
// Separate into Host and URI
$Host = substr($URL, 0, strpos($URL, "/");
$URI = strstr($URL, "/"
// Form up the request body
$ReqBody = "";
while (list($key, $val) = each($DataStream)) {
if ($ReqBody) $ReqBody.= "&";
$ReqBody.= $key."=".urlencode($val);
}
$ContentLength = strlen($ReqBody);
// Generate the request header
$ReqHeader =
"POST $URI HTTP/1.1\n".
"Host: $Host\n".
"User-Agent: PostIt\n".
"Content-Type: application/x- "Content-Length: $ContentLength\n\n".
"$ReqBody\n";
// Open the connection to the host
$socket = fsockopen($Host, 80, &$errno, &$errstr);
if (!$socket) {
$Result["errno"] = $errno;
$Result["errstr"] = $errstr;
return $Result;
}
$idx = 0;
fputs($socket, $ReqHeader);
while (!feof($socket)) {
$Result[$idx++] = fgets($socket, 128);
}
return $Result;
}
?>
/*
thanks Rob
*/