cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: Login Script for Linkpoint central

From: Colleen R. Dick <platypus_at_proaxis.com>
Date: Wed, 21 Nov 2007 11:43:16 -0800

Mike your script looks like the standard API script that linkpoint
provides. All I can say is make sure your copy of the cert doesn't have
any trailing spaces or newlines. I've had them fail because some
software inadvertently added nulls or something while copying.

And while we're talking about linkpoint,
-----------
I would like to automate logging into linkpointcentral
(that's the web management interface, not the actual banking system)
and downloading
order transactions on a daily basis. Then running a reconciliation
script between the transactions that have posted back to my database and
the ones linkpoint has recorded to make sure there is no discrepancy,
that's the easy part. I've downloaded the txns by hand and the
reconciliation script works great. But it's boring to do, and doesnt
require any brains so it's a good job for a computer.

I seem to be logging into linkpoint OK, but getting to where I want to
go once inside is a bit more of a problem....

I'd be happy to share this login script once I got it going.

 

  $login_data = 'storename=xxxxxx';
  $login_data .= '&username=xxxxxx';
  $login_data .= '&passwd=xxxxxx';
 
  $ch =
curl_init('https://www.linkpointcentral.com/lpc/servlet/LPCLogin');
   
  
 
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
  curl_setopt($ch, CURLOPT_CAINFO,
"/usr/share/curl/curl-ca-bundle.crt"); //obviously varies from server
to server
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_VERBOSE, 1);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $login_data);
  $data = curl_exec($ch);
  curl_close($ch);
  unset($ch);
   
/* at this point I have fetched the protected page. However it is a
frameset. The frame I want is called "content" and the type is landing.
So I get that.....*/

$start =strpos($data,"/lpc/servlet/LPCPage?pagetype=landing");
 $url=substr($data,$start);
 $end = strpos($url,'"');
 $url = substr($url,0,$end);
 $url = "https://www.linkpointcentral.com" . $url; //we have to make
it explicit since we're running remotely.
  
  //now we gotta curl to that page and see if it remembers our login
  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
  curl_setopt($ch, CURLOPT_CAINFO,
"/usr/share/curl/curl-ca-bundle.crt");
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_VERBOSE, 1);
   
  $data = curl_exec($ch);
  curl_close($ch);
  unset($ch);

/* This also seems to give me what I want. Now at this point I would
like to follow the Reports link but the link to do that is a javascript.
I'm hornswaggled. If I use my browser to generate the link it looks
very much like the content link, but the encrypted stuff is different
and it is the javascript that is encrypting the real name of the real
page we will actually be going to. And this javascript references
another javascript in the parent */

So I guess my question is how do I deal with scraping stuff out of a
framed document and running javascripts through curl
   

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-11-21