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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:49:21+00:00 2026-06-10T22:49:21+00:00

I’m trying to login to https://www.reporo.com/login.php using Curl. Here is code I’m using: <?php

  • 0

I’m trying to login to https://www.reporo.com/login.php using Curl. Here is code I’m using:

  <?php
function createPostString($aPostFields) {
    foreach ($aPostFields as $key => $value) {
        $aPostFields[$key] = urlencode($key . '=' . $value);
    }

    return urlencode(implode('&', $aPostFields));
}

$postFields['username'] = 'login';
$postFields['password'] = 'pass';
$postFields['submit'] = ' ';

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://www.reporo.com/login.php');
curl_setopt($curl, CURLOPT_REFERER, 'https://www.reporo.com/login.php');
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13');
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_COOKIEFILE, dirname(__FILE__) . '/cookies.txt');
curl_setopt($curl, CURLOPT_COOKIEJAR, dirname(__FILE__) . '/cookies.txt');
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS,  createPostString($postFields));

curl_exec($curl);
header('Location: https://www.reporo.com/analytics/dashboard.php');
curl_close($curl)


?>

After using script it redirects me to http://best-payroll-services.info/adder/login.php . Where is the problem ?

After var_dump(curl_getinfo($c)) I’ve got:

'url' => string 'https://www.reporo.com/login.php' (length=32)
  'content_type' => string 'text/html' (length=9)
  'http_code' => int 200
  'header_size' => int 382
  'request_size' => int 192
  'filetime' => int -1
  'ssl_verify_result' => int 20
  'redirect_count' => int 0
  'total_time' => float 0.843
  'namelookup_time' => float 0
  'connect_time' => float 0.109
  'pretransfer_time' => float 0.531
  'size_upload' => float 255
  'size_download' => float 3233
  'speed_download' => float 3835
  'speed_upload' => float 302
  'download_content_length' => float 3233
  'upload_content_length' => float 255
  'starttransfer_time' => float 0.655
  'redirect_time' => float 0
  'certinfo' => 
    array
      empty
  'redirect_url' => string '' (length=0)

Greetings.

  • 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-10T22:49:23+00:00Added an answer on June 10, 2026 at 10:49 pm

    There are a couple of things that are wrong with this script.

    • You need to change the relative path of cookies:

      if ( file_exists( 'cookies.txt' ) )
      

      to an absolute

      if ( file_exists( dirname( __FILE__ ).'/cookies.txt' ) )
      

      so that you’re sure it’s checking the right file.

    • Also str_replace( '/', '', $_SERVER[ "PHP_SELF" ] ); is a return function. That means you need to store the returned value:

      $redirect_url = str_replace( '/', '', $_SERVER[ "PHP_SELF" ] );
      header('Location:'.$redirect_url);
      

    I’ve slightly modified your code to this:

    function connect( $url, $post = '' )
    {
        $curl = curl_init();
        curl_setopt( $curl, CURLOPT_URL, $url );
        curl_setopt( $curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.100 Safari/534.30' );
        curl_setopt( $curl, CURLOPT_HEADER, 0 );
        curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1 );
        curl_setopt( $curl, CURLOPT_FOLLOWLOCATION, 0 );
        curl_setopt( $curl, CURLOPT_POST, 1 );
        curl_setopt( $curl, CURLOPT_POSTFIELDS, $post );
        curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, false );
        curl_setopt( $curl, CURLOPT_COOKIEFILE, __DIR__.'/cookies.txt' );
        curl_setopt( $curl, CURLOPT_COOKIEJAR,  __DIR__.'/cookies.txt' );
        $result = curl_exec( $curl );
        curl_close( $curl );
        return $result;
    }
    
    $login_data[ 'username' ] = $_POST['login'];
    $login_data[ 'password' ] = $_POST['password'];
    
    foreach ( $login_data as $key => $value ) {
        $post_items[ ] = $key.'='.$value;
    }
    $post_string = implode( '&', $post_items );
    
    if ( file_exists( __DIR__.'/cookies.txt' ) ) {
        // Cookies exist, point to a secured page?
        echo connect( 'https://yourhost/secure.php')
    }
    else {
        // Cookies don't exist post to a login page and redirect to a secured page?
        connect( 'https://yourhost/login.php', $post_string )
        $redirect_url = str_replace( '/', '', $_SERVER[ "PHP_SELF" ] );
        header( 'Location: '.$redirect_url );
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but

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.