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

  • Home
  • SEARCH
  • 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 9068021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:05:19+00:00 2026-06-16T17:05:19+00:00

I’m simply trying to automatically login to a login form via php and cURL

  • 0

I’m simply trying to automatically login to a login form via php and cURL

I have:

<?php
# get url to form
$url = "http://thesite.com/login.php";
$ch = curl_init($url); # initialize that form

#run value of $_POST variable in form fields from above url.
$params = "username='' OR '1'='1&password='' OR '1'='1&login-php-submit-button=submit";

## set cURL options
curl_setopt($ch, CURLOPT_POST, 1);  
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);  #set parameter $_POST fields
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
$response = curl_exec($ch);

    if (!$response) {
        $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close($ch); // make sure we closeany current curl sessions
        die(stripslashes($http_code.' Can\'t connect to server.'));
    }

//curl_close($ch); // close curl session 


## echo the result from cURL 'ing
echo $response;

curl_close($ch);
?>

When I visit this script it just shows the value of $url as if I just visited the URL, it doesnt show any error messages like “Wrong pass” or anything.

I feel like $params may not be setup correctly here. I have tried relentlessly to try to get this to work. I currently have it setup where the setup for $params values are:

formnameofinputvalue=valueToInputIntoFormElement&

where & separates each formInputName=formInputValue

Anyone see what I am doing wrong here? Thank you.

  • 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-16T17:05:20+00:00Added an answer on June 16, 2026 at 5:05 pm

    Does the login.php script submit the values to another URL? Check the source for the login.php page and see if the form is submitting to another URL (action= in the form element). If so, you will want to use that URL instead since that is where the values are being submitted. The login.php is only the form to collect the values.

    On the other hand, login.php might submit to itself, in which case you have the right URL.

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

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
this is what i have right now Drawing an RSS feed into the php,
I have a text area in my form which accepts all possible characters from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
I'm trying to create an if statement in PHP that prevents a single post
I am trying to loop through a bunch of documents I have to put
I have a jquery bug and I've been looking for hours now, I can't

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.