Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6916323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:35:16+00:00 2026-05-27T09:35:16+00:00

parse_str is not bahaving as I would expect… I am storing a string to

  • 0

parse_str is not bahaving as I would expect…

I am storing a string to a cookie. It has been prepared using http_build_query and then base64 encoded.

when I read the cookie, I base64_decode, and url_decode. this gives me the following string: (values have been changed in some cases, ip etc.)

$string:

session_id=41a69e102653568b6e483b3eba861484&page_type=&ip=101.101.101.101&host=host101.101.101.101.in-addr.btopenworld.com&user_agent=Mozilla/5.0 (Windows NT 6.1; rv:8.0.1) Gecko/20100101 Firefox/8.0.1&referer=https://domain.com/&referer_domain_tld=domain.com&referer_keywords=&URI=/index.php?path=statistics&fn=test.php&URLdomain.com/index.php?path=statistics&fn=test.php&html_title=&browser=&browser_version=&OS=&OS_version=Windows Windows 7&screen_resolution=&start_date=1323358398&date=1323358398&referer_search_position=&load_time=0.00300002098083&id=&cs=e14272b7e8d9053a5e85ee72083faa5d

here is the code:

    $cookie_data = urldecode(base64_decode($_COOKIE[$stats_cookie_name]));                                  // decode and clean the cookie data. This is the cookie data all decoded and ready to convert to an key->value array.

    $cookie_data_ar = array();

    $cookie_data_ar = parse_str($cookie_data);  

In theory, using parse_str($string) should convert this string into a neat array. But its not. Totally crosseyed now and have wasted hours already. Im sure its somthing stupid, just cant see it. Fresh eyes please!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:35:17+00:00Added an answer on May 27, 2026 at 9:35 am

    You should check the doc. parse_str returns void. The second argument, however, is assigned (by reference) an array you are after:

    void parse_str ( string $str [, array &$arr ] )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this question has been asked before but the solutions did not work
I am attempting to parse a string like the following using a .NET regular
How would you parse the values in a string, such as the one below?
Is there any reliable alternative to parse_str() function for parsing a query string? I
I have this code.... file_parser::file_parser(string file){ txtfile.open(file.c_str(), ios::in); if (!txtfile.good()){ string error=err(0, +file+ not
using Org.BouncyCastle.Math; string p = E7A69EBDF105F2A6BBDEAD7E798F76A209AD73FB466431E2E7352ED262F8C558F10BEFEA977DE9E21DCEE9B04D245F300ECCBBA03E72630556D011023F9E857F; BigInteger P= new BigInteger(p); throwing Exception System.FormatException: Input
I'm trying to parse a simple JSON string, but I'm not used to do
I parse data using JSON in javascript, I find this is very convenient. But
I parse some values from an xml file. There is a @25-12-2010'T'23:40:00 string with
I'm wanting to parse a string into a nullable int in C#. ie. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.