Greetings,
We use debian package: php4 4.1.2-6.
We use a GET request to initiate a "status request"
process on
another server and want to split the output into fields.
My php code is:
--------------------------
$send = "GET \
/servlet/gateway?Client=TEST&Q=CacheRefreshReque
stStatus \
HTTP/1.1\r\n\r\n";
fputs ($conn, $send);
while (!feof ($conn)) {
$res = fgets ($conn, 1024);
// Skip the headers.
if (ereg ("^\r\n$", $res))
$flag = true;
if (!$flag)
continue;
$refresh_status .= $res;
}
fclose ($conn);
print $refresh_status;
parse_str($refresh_status);
echo $RefreshID1;
echo $PartialRefresh1;
echo $RefreshID2;
echo $PartialRefresh2;
var_dump($RefreshID1);
var_dump($RefreshID2);
-----------------------
The print statement returns:
RefreshID1=3&PartialRefresh1=Y&State1=Running&Re
freshID2=3&P
artialRefresh2=N&State2=Queued&
Now:
echo $RefreshID1; <---- returns empty
echo $PartialRefresh1; <------ returns "Y"
echo $RefreshID2; <---- returns empty
echo $PartialRefresh2; <------ returns "N"
var_dump($RefreshID1); <----------- returns NULL
var_dump($RefreshID2); <----------- returns NULL
is this normal behaviour?
Why would these fields return "NULL", instead of "3"
and "4"?
What I need to do is split the string into fields separated
by the "&"
symbol, and then split the subsequent fields into
subfields separated by
the "=" character. I then need the values, such as "3",
"4", "Y", "N",
"Running", "Queued", etc.
Any help would be appreciated.
Adrian
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php