Solved

Curl + Https + Cookies [HELP]

Posted on 2010-11-10
3
375 Views
Last Modified: 2012-05-10
Hello there,

i was wasting 7 days, to solve this problem :

i want verify  result of post username & password on a https:// web site they use a token + cookies to verify there form.

here is my code attached:

Please i want a Quick  solution, im new here and i hope that i will stay asking my question here for a long term.

Thank you in adnace!


<?php
if (isset ($_POST['curlme']) && $_POST['curlme'] === 'Envoyer') {

$url = 'https://sitename.com/portal/Index.do';
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
?>
<textarea>
<?php
echo $Rec_Data=curl_exec($ch);
echo $httpStatus=curl_getinfo($ch,CURLINFO_HTTP_CODE);
?>

</textarea>
<?php
exit;

}
?>
<form action="" method="post">
 <p>
  <label for="chiffre">Entrez un chiffre</label>
  <input type="text" name="login" id="username" />
  <input type="text" name="password" id="pwd" />
 </p>
 <p>
  <input type="submit" name="curlme" value="Envoyer" />
 </p>
</form>

Open in new window

0
Comment
Question by:imadt
  • 2
3 Comments
 

Author Comment

by:imadt
ID: 34104884
Any Answers? Pleaaaaaaaaaase
0
 
LVL 40

Accepted Solution

by:
noci earned 500 total points
ID: 34109607
why php in the first place?
why not native curl from a command prompt....
(You can at least validate your query that way and then translate the needed arguments into php or whatever).
This is what your query translates into (commandline options) do they work? then you script too.

curl  -k  -d curlme=Envoyer  -A "Some APACHE/LIGTHPD/HYAWATHA/NGINX user agent string"  https://sitename.com/portal/Index.do

0
 

Author Closing Comment

by:imadt
ID: 34113985
he is th only who reply ^^
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developer tools in browsers have been around for a while, yet they are still heavily underused by developers. Developers still fix html or CSS then refresh page to see effect, or they put alert or debugger in JavaScript and then try again and again …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
This video teaches users how to migrate an existing Wordpress website to a new domain.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now