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 1021247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:16:59+00:00 2026-05-16T11:16:59+00:00

I have this python script b_string = pack(‘>hqh2sh13sh5sh3sBiiihiiiiii’, 21, 0, len(country), country, len(device), device,

  • 0

I have this python script

b_string = pack('>hqh2sh13sh5sh3sBiiihiiiiii',
                21, 0,
                len(country), country,
                len(device), device,
                len('1.3.1'), "1.3.1",
                len('Web'), "Web",
                27, 0, 0,
                3, 0, cid, lac,
                0, 0, 0, 0)

and I want to convert it to php, this is what I came with so far

$body= pack('nln2c*n13c*n5c*n3c*Ciiiniiiiii',
                    21, 0,
                    strlen($this->_mccToCountry[$this->_mcc]), $this->_mccToCountry[$this->_mcc],
                    strlen($this->_device), $this->_device,
                    strlen('1.3.1'), "1.3.1",
                    strlen('Web'), "Web",
                    27, 0, 0,
                    3, 0, $this->_cellId, $this->_lac,
                    0, 0, 0, 0);

The variables are same as those in python script, but i got this error

PHP Warning: pack(): Type n: too few arguments in …/application/extensions/Zend-extensions/NMS/Bts.php:150

The help will be very appreciated.

  • 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-16T11:16:59+00:00Added an answer on May 16, 2026 at 11:16 am

    Your parameter string is all screwed up. You indicate in places that you are going to pass 2, 5, 3 and 13 shorts, but only provide one each time. You indicate that you are going to provide a series of characters but then you provide a NUL terminated string. You indicate that you will be providing an unsigned char but don’t provide one. Try this format string instead:

    'nlna*na*na*na*i3ni6'
    

    Another option is to use serialize and deserialize instead. Not sure if it matters to you that the data is packed into bytes or serialized into strings.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know python functions are virtual by default. Let's say I have this: class
I'm a newbie to python and the app engine. I have this code that
Not many are aware of this feature, but Python's functions (and methods) can have
I have this RewriteRule that works too well :-) RewriteRule ^([^/]*)/$ /script.html?id=$1 [L] The
I received this python script that generates a file checksum: import sys,os if __name__==__main__:
I have been receiving errors when trying to save and run this Python 3.1
I have one question, I have such code this._engine = Python.CreateEngine(); ScriptSource source =
I have a long-running Python script that I run from the command-line. The script
I have a python script that creates a list of lists of server uptime
I have a Python script so far that does what I it to... Opens

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.