CodeIgniter Forums
Invalid session token on request - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Invalid session token on request (/showthread.php?tid=65522)



Invalid session token on request - z3r0nin3 - 06-21-2016

I've been using REQUEST  with Codeigniter 3 on my project.

what i want to achieve is to populate our data to this website . The site needs authentication before we could create or post the data.

here is my code

Code:
function submit_immi(){

$this->load->library(array('PHPRequests'));

$options = array(
       'auth' => new Requests_Auth_Basic(array('myusername', 'mypassword'))
   );      

   $response = Requests::post('https://online.immi.gov.au/lusc/login', array(), $options);      

   var_dump($response->body);
}

this is the result

Quote:string(5578) " ]> ImmiAccountLogin to ImmiAccountFields marked * must be completed.UsernamejoserespallPasswordLoginCancelI have forgotten my ImmiAccountusername or password Create an ImmiAccountCreate an ImmiAccount to access the Department of Immigration and Border Protection's online services.Create ImmiAccountAccessibilityCopyright & DisclaimerOnline SecurityPrivacy"

I've been approaching it with different method, when i viewed the source code and checked the form url, i noticed that it passess 2 arguments.

here is my code

Code:
function submit_immi(){
   $this->load->library(array('PHPRequests'));

   $data = array(
       '_2b0a0a0d0b0'  =>  'username',
       '_2b0a0a0d1b0'  =>  'password'
   );

   $response = Requests::get('https://online.immi.gov.au/lusc/login',array(),$data);

   preg_match_all('/value="([^\"]+)/',$response->body,$match);

   $wc_s = $match[1][0];
   $wc_t = $match[1][1];

   $response = Requests::post("https://online.immi.gov.au/lusc/login?wc_s=$wc_s&wc_t=$wc_t",array(),$data);

   var_dump($response->body);
}

this is the result

Quote:string(2362) " ]> Manage my ImmiAccount Invalid session token on request. Accessibility Copyright & Disclaimer Online Security Privacy "

Am i doing it wrong?

Can someone point me on the right path?

Thank you.


RE: Invalid session token on request - PaulD - 06-22-2016

That is not going to work. It if did you could create a program to try multiple logins until one worked.

If they have an API, you would need to join and get an API key to use to login remotely.

Paul.


RE: Invalid session token on request - z3r0nin3 - 06-22-2016

Thanks for the reply PaulD, unfortunately they don't have an API.

What i want to achieve is to submit our existing data to their website which needs authentication. i was told that this is achievable using cURL, since REQUEST uses cURL and fsockopen i used it on my project.

The reason we wanted to automate this is to minimize the encoding of data on our side since we already have it.

Thanks again.