Jump to content

PHP and jhtml - Authenticate using HTTPS


scrapdog

Recommended Posts

Hi all,

I'm new to PHP but have experience with other languages. I'm currently trying to do the following:

1. Authenticate to https://www.example.com/example/v1/services/app/external_profile_login.jhtml?login=username&password=password&locale=en_us
2. Pull XML from http://www.example.com/example/v1/services/app/get_user_data.jhtml (this page is essentially just XML)

In order to get any data from the second page, you must be authenticated. When I do the above in a web browser it works fine (and maintains the session as required).

Here is what I have so far (don't laugh too hard) after learning about cURL:

[code]// Declare vars
$xsl = new DomDocument();
$inputdom = new DomDocument();
$proc = new XsltProcessor();

// Authenticate
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'https://www.example.com/example/v1/services/app/external_profile_login.jhtml?login=username&password=password&locale=en_us');
curl_exec($curl_handle);

// Load the XML
$inputdom->load("http://www.example.com/example/v1/services/app/get_user_data.jhtml");

// Bind
$xsl = $proc->importStylesheet($xsl);

// Output the information!
$newdom = $proc->transformToDoc($inputdom);
print $newdom->saveXML();

// Close the connection
curl_close($curl_handle);[/code]

Any help would be greatly appreciated. Thanks!

Link to comment
https://forums.phpfreaks.com/topic/28630-php-and-jhtml-authenticate-using-https/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.