TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 06-22-2009, 05:32 AM   #1 (permalink)
The Wanderer
 
rupam_jaiswal's Avatar
 
Join Date: Jun 2008
Posts: 8
Thanks: 0
rupam_jaiswal is on a distinguished road
Default Curl login to https

Hi,
Please excuse if similar issue has been posted earlier.
My scenario is
Login to a https site .
Once I login,I find a link to download a file.
Now all this I want to do with the help of curl.
I want the script for
1) login to https site
2)download the file?After applying the regex,I can get the link of the file easily but problem comes for downloading the file?Do I have to use JavaScript for that or use location header to redirect to file download link?
Thanks in advance
rupam_jaiswal is offline  
Reply With Quote
Old 06-22-2009, 09:57 AM   #2 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

There are a few cURL options when accessing a HTTPS resource, but the one I used in my script when I wrote one, was the following:

php Code:
$szUrl  = 'https://www.example.com/';
$pCurl  = curl_init();

curl_setopt($pCurl, CURLOPT_URL, $szUrl);
curl_setopt($pCurl, CURLOPT_USERPWD, 'username:pasword');
curl_setopt($pCurl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($pCurl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($pCurl, CURLOPT_RETURNTRANSFER, true);

$szData = curl_exec($pCurl);
curl_close($pCurl);

As far as downloading the file is concerned, once you have the download link then all you have to do is make a call to it, either with cURL, or file_get_contents. Treat it just as though you're fetching web-page data.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 06-22-2009, 03:41 PM   #3 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Quote:
Originally Posted by rupam_jaiswal View Post
I want the script for
1) login to https site
2)download the file?
"I want" does not mean "you'll get". Please show at least some effort that you've tried to do this yourself but hit a stumbling block. Do you have a script which can download a file from a non SSL URL? What have you tried, after getting the link, to download the file? Have you made any attempt at talking to an SSL connection?
Salathe is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot use CURL? allworknoplay Absolute Beginners 19 03-21-2009 08:27 PM
How to Login to Any Account on an Insecure Site Wildhoney Tips & Tricks 18 12-14-2008 09:58 PM
First Login Script StevenF Absolute Beginners 33 02-15-2008 03:13 PM
user login page sarmenhb General 4 01-22-2008 09:33 AM
Highly secure login system ReSpawN Advanced PHP Programming 6 12-12-2007 08:28 PM


All times are GMT. The time now is 06:03 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design