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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:06:27+00:00 2026-06-01T07:06:27+00:00

Hi guys I have a python script that posts some data to google and

  • 0

Hi guys I have a python script that posts some data to google and gets back response. The script is below

net, cid, lac = 24005, 40242, 62211
import urllib
a = '000E00000000000000000000000000001B0000000000000000000000030000'
b = hex(cid)[2:].zfill(8) + hex(lac)[2:].zfill(8)
c = hex(divmod(net,100)[1])[2:].zfill(8) + hex(divmod(net,100)[0])[2:].zfill(8)
string = (a + b + c + 'FFFFFFFF00000000').decode('hex')
try:
  data = urllib.urlopen('http://www.google.com/glm/mmap',string)
  r = data.read().encode('hex')
  print r
except:
  print 'connect error'

I want to get the same response with a ruby script. I am not able to form the request properly and I always get the badimplementation error or http 501 error. Could you tell me where the mistake is at? (The ruby script is attached below).

require 'net/http'
def fact(mnc,mcc,cid,lac)
  a = '000E00000000000000000000000000001B0000000000000000000000030000'
  b = cid.to_s(16).rjust(8,'0') + lac.to_s(16).rjust(8,'0')
  c = mnc.to_s(16).rjust(8,'0') + mcc.to_s(16).rjust(8,'0')
  string = [a + b + c + 'FFFFFFFF00000000'].pack('H*')
  url = URI.parse('http://www.google.com/glm/mmap')
  resp = Net::HTTP.post_form(url,string)
  print resp
end
puts fact(5,240,40242,62211)
  • 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-06-01T07:06:29+00:00Added an answer on June 1, 2026 at 7:06 am

    From the documentation:

    Posts HTML form data to the specified URI object. The form data must be provided as a Hash mapping from String to String.

    You have to pass the parameters, if I understood that correctly, on the form:
    {"param1" => "value1", "param2"=>"value2"}

    I just didn’t understand what are the names of the parameters you are passing on your request.

    Here are some usage examples for the method Net::HTTP::post_form, also from the official doc:

    Ex 1:

    uri = URI('http://www.example.com/search.cgi')
    res = Net::HTTP.post_form(uri, 'q' => 'ruby', 'max' => '50')
    puts res.body
    

    Ex2:

    uri = URI('http://www.example.com/search.cgi')
    res = Net::HTTP.post_form(uri, 'q' => ['ruby', 'perl'], 'max' => '50')
    puts res.body
    

    Link to the examples

    Hope it helps

    edit: function that accepts a String as a parameter to the post request: Net::HTTP::request_post

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

Sidebar

Related Questions

I have a python script that creates and starts 3 threads, and then goes
hey guys, I need help considering win32com in Python: I have a routine that
Seeing all the UNIX guys have memcache (PHP, Python, etc.), are the .NET libraries
Guys, I have a python script which builds up a MySQL table with timestamps
Hey guys. So, I have a Python script. Let's call it Pythonfile.py (Wow, I
Python list comprehensions are nice, but near impossible to debug. You guys have any
I guys, I developing a utility in python and i have 2 object the
Hi guys I have a google apps account set up and even set up
Hi guys I have a weird question, I have a cli php script runs
Guys, I have much python code in modules which are resides in several python

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.