Extracting individual vaues from a query string


#1

Hi there,

I’ve used the cUrl library to return a query string from a remote server to a variable. The

query string looks a bit like this:

…php?message_id=a1&recipient=unit1&sendday=fri

At the moment, the whole of this query string is contained in a single variable ($qstring) so if I print $qstring, “message_id=a1&recipient=unit1&sendday=fri” will be sent to the browser.

Can anyone tell me how to break the values “a1”, “unit1” and “fri” into individual variables

so that I can start using them in the rest of my code like this:

$message_id = “a1”;
$recipient = “unit1”;
$sendday = “fri”;

I’d like to achive this in the same php script rather than sending it to another page to GET

the elements of the query string.

Thanks in advance,
Paul.


#2

explode() or split() should be able to help you out in that department :wink: