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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:39:10+00:00 2026-06-16T21:39:10+00:00

This is my first time posting here. I greatly appreciate any and all guidance

  • 0

This is my first time posting here. I greatly appreciate any and all guidance on this subject.

I’m trying to make a program that automatically fills in web forms and submits the data, returning the resulting page to the program so it can continue to ‘browse’ the page, allowing it to recursively submit even more data.

The main problems I’m having are:

  • The ‘submit’ button is coded in Javascript, so I don’t know where the form data goes when making the page request.
  • I want to fill in the forms using data from an Excel table, so I need to be able to access data from outside the page.
  • I need to be able to navigate the resulting page to continue to submit more data.

More specifically, I’m trying to first login to the Practice Mate website, navigate to ‘Manage Patients’, hit ‘Add Patients’, and fill in the proper forms and submit.
I’m filling in the forms from an Excel table thousands of rows long.
Sorry I can’t be more clear on this without providing a username and password.

What I’ve been trying to do is use Javascript to make page requests from a page that retrieves information from the Excel document using PHP. I still can’t seem to get anything to work with this method though.

I apologize for being a relative novice at this. Thanks in advance.

  • 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-16T21:39:11+00:00Added an answer on June 16, 2026 at 9:39 pm

    You can use PHP cURL to browse & submit forms to websites, but it does depend on how the website is setup. Most have security checks in place to prevent bots and can be tricky to get everything to work right.

    I spent a little bit of time and came up with this login script. Without a valid username and password I can’t verify that it is successful, but should do what you need. This short example first browses to the page to set any cookies and scrape a __VIEWSTATE value needed to submit the form. It then submits the form using the username/password you provide.

    <?php
    
    // Login information
    $username = 'test';
    $password = 'mypass';
    $utcoffset = '-6';
    $cookiefile = '/writable/directory/for/cookies.txt';
    
    $client = new Client($cookiefile);
    
    // Retrieve page first to store cookies 
    $page = $client -> get("https://pm.officeally.com/pm/login.aspx");
    // scrape __VIEWSTATE value
    $start = strpos($page, '__VIEWSTATE" value="') + 20;
    $end = strpos($page, '"', $start);
    $viewstate = substr($page, $start, $end - $start);
    
    // Do our actual login
    $form_data = array(
        '__LASTFOCUS' => '', 
        '__EVENTTARGET' => '',
        '__EVENTARGUMENT' => '',
        '__VIEWSTATE' => $viewstate,
        'hdnUtcOffset' => $utcoffset,
        'Login1$UserName' => $username,
        'Login1$Password' => $password,
        'Login1$LoginButton' => 'Log In'
    );
    $page = $client -> get("https://pm.officeally.com/pm/login.aspx", $form_data);
    
    // cURL wrapper class    
    class Login {
        private $_cookiefile;
    
        public function __construct($cookiefile) {
            if (!is_writable($cookiefile)) {
                throw new Exception('Cannot write cookiefile: ' . $cookiefile);
            }
            $this -> _cookiefile = $cookiefile;
        }
    
        public function get($url, $referer = 'http://www.google.com', $data = false) {
            // Setup cURL
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_REFERER, $referer);
            curl_setopt($ch, CURLOPT_COOKIEFILE, $this -> _cookiefile);
            curl_setopt($ch, CURLOPT_COOKIEJAR, $this -> _cookiefile);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
            curl_setopt($ch, CURLOPT_AUTOREFERER, true);
            curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
    
            // Is there data to post
            if (!empty($data)) {
                curl_setopt($ch, CURLOPT_POST, 1);
                curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
            }
    
            return curl_exec($ch);
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is my first time posting here, I have a question which I have
use this website a lot but first time posting. My program creates a number
That's my first time posting on stackoverflow. I've been finding usefull answers on this
this is my first time posting on here and have read alot of helpful
This is my first time posting a question here, I usually find answers in
First time posting here, last alternative to getting even more frustrated with this non-sense.
So this is my first time posting here but I'm more or less stumped.
This is my first time posting to Stack Overflow. I'm trying to build a
This is my first time posting here, so I apologize in advance for the
This is my first time posting here, but I've found a lot of answers

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.