[PHP] parse_str() expects parameter 1 to be string, array given

2009-10-19 Thread Julian Muscat Doublesin
Hello* *Everyone,

I am geetting the error below. Can you please guide me on a fix. It is
working on the live site but not on local server. Has anyone ever experinced
this error before.
*
Warning*: parse_str() expects parameter 1 to be string, array given**


Re: [PHP] parse_str() expects parameter 1 to be string, array given

2009-10-19 Thread Tommy Pham
On Mon, Oct 19, 2009 at 12:45 AM, Julian Muscat Doublesin
opensourc...@gmail.com wrote:
 Hello* *Everyone,

 I am geetting the error below. Can you please guide me on a fix. It is
 working on the live site but not on local server. Has anyone ever experinced
 this error before.
 *
 Warning*: parse_str() expects parameter 1 to be string, array given**


1) Some code would be give more info as where the bug is.
2) Did you read this? http://www.php.net/manual/en/function.parse-str.php

Regards,
Tommy

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] parse_str and NULL entry problem

2003-06-15 Thread Adrian Bolzan


Greetings,

We use debian package: php44.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=TESTQ=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=3PartialRefresh1=YState1=RunningRe
freshID2=3P
artialRefresh2=NState2=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



[PHP] parse_str and NULL entry problem

2003-06-11 Thread Adrian Bolzan
Greetings,

We use debian package: php44.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=TESTQ=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=3PartialRefresh1=YState1=RunningRe
freshID2=3P
artialRefresh2=NState2=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



[PHP] parse_str()

2003-03-31 Thread Jose
I might be wrong here, but with the code below I would expect $_GET to be
filled and the script to output the next line:

   ?php
   $example_string = 'action=kickitem=me';
   parse_str($example_string);
   var_dump($_GET);
   ?

// expected output:
//
// array(2) { [action]=  string(4) kick [item]=  string(2) me }
//

Is my assumption wrong? What would be the workaround?

Thanks,

Jose


 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] parse_str()

2003-03-31 Thread Jose
 I might be wrong here, but with the code below I would expect $_GET to be
 filled and the script to output the next line:
 
?php
$example_string = 'action=kickitem=me';
parse_str($example_string);
var_dump($_GET);
?
 
 // expected output:
 //
 // array(2) { [action]=  string(4) kick [item]=  string(2) me }
 //

Forgot to mention what I get. 

// actual output:
//
// array(0) { }


 Is my assumption wrong? What would be the workaround?
 
 Thanks,
 
 Jose
 
 
 
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] parse_str()

2003-03-31 Thread Marcus Rasmussen
This should work:

parse_str($example_string, $_GET);

___
Marcus Rasmussen
[EMAIL PROTECTED]
www.marcusr.dk

-
On 01-04-2003 at 03:20 Jose wrote:
-

 I might be wrong here, but with the code below I would expect $_GET to be
 filled and the script to output the next line:

?php
$example_string = 'action=kickitem=me';
parse_str($example_string);
var_dump($_GET);
?

 // expected output:
 //
 // array(2) { [action]=  string(4) kick [item]=  string(2) me }
 //

Forgot to mention what I get.

// actual output:
//
// array(0) { }


 Is my assumption wrong? What would be the workaround?

 Thanks,

 Jose






 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] parse_str () problems. using on the command line args ( argv[1]) - problem with php-4.2.2 ??

2002-08-03 Thread Neil

Hello All

I am trying to use parse_str in my script , passing a variable.

I have old code, working with php 4.1.2 working with the following script :

[root@zion kickstart]# cat make-kickstart.php


#!/usr/local/bin/php -q
?
// parse any arguments
parse_str ($argv[1]) ;

print NAME: $name \n;

?

for some reason tho , under 4.2.2 it is not parsing the argument/s

[root@zion kickstart]# ./make-kickstart.php name=lxmode
NAME:

Does any one know if anything changed in 4.2.2 , I swear it works under
4.1.2 or older.

Thanks for any advice or info in advance !!

Cheers

Neil



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] parse_str and parse_url

2001-10-19 Thread Olexandr Vynnychenko

Hello php-general,

  I need a function which is opposite to parse_str or parse_url, i.e.
  it makes string containing URL with passed variablenames and
  variablevalues. Did someone see such function? I can't find it in th
  manual. Thank's.

-- 
Best regards,
 Olexandr Vynnychenko  mailto:[EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]