Jump to content

Jimmie89

New Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by Jimmie89

  1. Hi monkeypaw201! I have a similar issue, except I log into a secure site. I've got this part working by using the following: $url = "https://www.fragrancex.com/customeraccount/customer_center.html"; $cr = curl_init($url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_CAINFO, getcwd() . "fragrancex-chain.crt"); $curl_ret = curl_exec($cr); curl_close($cr); //run the process and fetch the document $doc = curl_exec($ch); //print output echo $doc; however, now I need to pass a value $__RequestVerificationToken back to the page and submit to login. I've borrowed your example above and tried a couple things, but it won't login. Would you kindly assist? Here's the full code: <?php $url = "https://www.fragrancex.com/customeraccount/customer_center.html"; $cr = curl_init($url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_CAINFO, getcwd() . "fragrancex-chain.crt"); $curl_ret = curl_exec($cr); curl_close($cr); //run the process and fetch the document $doc = curl_exec($ch); // extract __RequestVerificationToken input field $__RequestVerificationToken = explode('<input name="__RequestVerificationToken" type="hidden" value="',$doc); $__RequestVerificationToken = explode('" />',$__RequestVerificationToken[1]); $__RequestVerificationToken = $__RequestVerificationToken[0]; curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_CAINFO, getcwd() . "fragrancex-chain.crt"); // ENABLE HTTP POST curl_setopt ($ch, CURLOPT_POST, 1); // SET POST PARAMETERS : FORM VALUES FOR EACH FIELD curl_setopt ($ch, CURLOPT_POSTFIELDS, '__RequestVerificationToken='.$__RequestVerificationToken.'&UserName=somewhere%40over.the.rainbow&NewUser=False&Password=12345&action=Sign+in+using+our+secure+server&ReturnUrl='); //run the process and fetch the document $doc = curl_exec($ch); //terminate curl process curl_close($ch); //print output echo $doc; ?> Thanks in advance! J
×
×
  • 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.