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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:44:43+00:00 2026-05-29T21:44:43+00:00

I need a circa 2012 example of how to login to UPS using PHP

  • 0

I need a circa 2012 example of how to login to UPS using PHP cURL. I am not closing the session between calls. There are 3 pages to be fetched, 1) The login page 2) The password page and 3) the invoice page

I had it work before, however it doesn’t anymore. I deleted the cookie file and it worked for a while, then I get the message “Your current request has timed out due to inactivity. You will need to restart your request.” If I don’t login within a window it times out even on a successful login. I tried deleting the cookie file and starting again and that didn’t work. Any ideas how to make it so the timeout window is infinite? Here’s the code I have, credentials removed:

              $cookie_file_path = "/tmp/cookie.txt";
              // remove previous cookie
              if (file_exists($cookie_file_path)) {
            `rm -fr {$cookie_file_path}`;
              } 
            $login_url = 'https://www.ups.com/one-to-one/login';
            $password_url = 'https://www.ups.com/one-to-one/password';
            $invoice_url = 'upsDOTcomSLASHviewbillSLASHinvoices';
            $agent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20100101 Firefox/10.0";

            $login_data = "sysid=null&lang=null&langc=null&method=null&returnto=null&loc=en_US&uid=<user_id>&rememberMe=1&next=Next&pm_fp=version%253D1%2526pm%255Ffpua%253Dmozilla%252F5%252E0%2520%2528windows%2520nt%25206%252E1%253B%2520wow64%253B%2520rv%253A10%252E0%2529%2520gecko%252F20100101%2520firefox%252F10%252E0%257C5%252E0%2520%2528Windows%2529%257CWin32%2526pm%255Ffpsc%253D24%257C1920%257C1200%257C1160%2526pm%255Ffpsw%253D%257Cqt6%257Cqt5%257Cqt4%257Cqt3%257Cqt2%257Cqt1%257Cswf%257Cpdf%257Cpdf%2526pm%255Ffptz%253D%252D5%2526pm%255Ffpln%253Dlang%253Den%252DUS%257Csyslang%253D%257Cuserlang%253D%2526pm%255Ffpjv%253D1%2526pm%255Ffpco%253D1";
            $password_data = "sysid=null&lang=null&langc=null&method=null&returnto=null&loc=en_US&password=<password>&next=Log+In&pm_fp=version%253D1%2526pm%255Ffpua%253Dmozilla%252F5%252E0%2520%2528windows%2520nt%25206%252E1%253B%2520wow64%253B%2520rv%253A10%252E0%2529%2520gecko%252F20100101%2520firefox%252F10%252E0%257C5%252E0%2520%2528Windows%2529%257CWin32%2526pm%255Ffpsc%253D24%257C1920%257C1200%257C1160%2526pm%255Ffpsw%253D%257Cqt6%257Cqt5%257Cqt4%257Cqt3%257Cqt2%257Cqt1%257Cswf%257Cpdf%257Cpdf%2526pm%255Ffptz%253D%252D5%2526pm%255Ffpln%253Dlang%253Den%252DUS%257Csyslang%253D%257Cuserlang%253D%2526pm%255Ffpjv%253D1%2526pm%255Ffpco%253D1";

            $headers[] = "Accept: */*";
            $headers[] = "Connection: Keep-Alive";
            $headers[] = "Content-Type: application/x-www-form-urlencoded";
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $login_url);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 
            curl_setopt($ch, CURLOPT_USERAGENT, $agent);
            curl_setopt($ch, CURLOPT_POST, 1); 
            curl_setopt($ch, CURLOPT_POSTFIELDS, $login_data); 
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
            curl_setopt($ch, CURLOPT_REFERER, 'https://www.ups.com/myups/login'); 
            curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
            curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path); 
            ob_start();
            $result = curl_exec ($ch);
            ob_end_clean();
            echo curl_error($ch);   // prints nothing if successful
            //curl_close($ch);


            //$ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $password_url);
            curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
            curl_setopt($ch, CURLOPT_HEADER, 1);
            curl_setopt($ch, CURLOPT_USERAGENT, $agent); 
            curl_setopt($ch, CURLOPT_POST, 1); 
            curl_setopt($ch, CURLOPT_POSTFIELDS, $password_data); 
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
            curl_setopt($ch, CURLOPT_REFERER, $login_url); 
            curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
            curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path); 
            ob_start();
            $result = curl_exec ($ch);
            ob_end_clean();
            echo curl_error($ch)        // prints nothing if successful
            //curl_close($ch);


            //$ch = curl_init();
           curl_setopt($ch, CURLOPT_URL, $invoice_url);
           curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/html; charset=utf-8'));
           curl_setopt($ch, CURLOPT_HEADER, 1);
            curl_setopt($ch, CURLOPT_USERAGENT, $agent); 
            curl_setopt($ch, CURLOPT_POST, 1); 
            curl_setopt($ch, CURLOPT_POSTFIELDS, $invoice_data); 
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
            curl_setopt($ch, CURLOPT_REFERER, $password_url);
            curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
            curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path); 
            ob_start(); 
            $result = curl_exec ($ch);
            ob_end_clean();
            echo curl_error($ch);       // prints nothing if successful
            curl_close($ch);

I can’t get past the first login page even after deleting and re-creating cookie file, as I get:

Your current request has timed out due to inactivity. You will need to restart your request.

Any help is 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-29T21:44:46+00:00Added an answer on May 29, 2026 at 9:44 pm
    1. Try connecting from another server. Maybe you got blacklisted.
    2. Play with CURLOPT_FRESH_CONNECT or CURLOPT_FORBID_REUSE curl options.
    3. Visit login page before submiting the post data
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the correct way to invoke stored procedures using modern day (circa 2012)
Need to insert selected text on the page into textarea. There must be some
Need some advice to use iframe for widget or not. Will some addons/plugin block
Need to add it to textview, for example, standard java-code.
I am working with some legacy (circa 2003) javascript and html code and need
Need help with PHP/MySql. Need to select all the records from 'today'. My table
Need something simulat jcrop plucgin (link to example is here: http://publikz.com/one-more-task-rounded-selection-in-jquery/ ) but with
Need advise I am currently using CRM4.0 webservice to create account from reading my
need to return an array like this for example: array(30 => 'Mercedes Benz 310
Need prettier solution of below example but with std::accumulate. #include <algorithm> #include <vector> #include

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.