iGuest 3 Report post Posted April 7, 2011 OMG! That was exactly what I was looking for, and it took me forever to find a script.Thanks, now I will use it >> Pls show me where is my errors in this code :<?php// INIT CURL$ch = curl_init();// SET URL FOR THE POST FORM LOGINcurl_setopt($ch, CURLOPT_URL, 'http://http://www.vn-zoom.com/index.php;);// ENABLE HTTP POSTcurl_setopt ($ch, CURLOPT_POST, 1);// SET POST PARAMETERS : FORM VALUES FOR EACH FIELDcurl_setopt ($ch, CURLOPT_POSTFIELDS, 'vb_login_username=meomunsocola&vb_login_password=t13h6x');// IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIEScurl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');# Setting CURLOPT_RETURNTRANSFER variable to 1 will force cURL# not to print out the results of its query.# Instead, it will return the results as a string return value# from curl_exec() instead of the usual true/false.curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);// EXECUTE 1st REQUEST (FORM LOGIN)$store = curl_exec ($ch);// SET FILE TO DOWNLOADcurl_setopt($ch, CURLOPT_URL, 'http://forums.xisto.com/no_longer_exists/;);// EXECUTE 2nd REQUEST (FILE DOWNLOAD)$content = curl_exec ($ch);// CLOSE CURLcurl_close ($ch); ?> Share this post Link to post Share on other sites
iGuest 3 Report post Posted June 11, 2011 >> Pls show me where is my errors in this code : <?php// INIT CURL$ch = curl_init();// SET URL FOR THE POST FORM LOGINcurl_setopt($ch, CURLOPT_URL, 'http://forums.xisto.com/no_longer_exists/;);// ENABLE HTTP POSTcurl_setopt ($ch, CURLOPT_POST, 1);// SET POST PARAMETERS : FORM VALUES FOR EACH FIELDcurl_setopt ($ch, CURLOPT_POSTFIELDS, 'vb_login_username=meomunsocola&vb_login_password=t13h6x');// IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIEScurl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');# Setting CURLOPT_RETURNTRANSFER variable to 1 will force cURL# not to print out the results of its query.# Instead, it will return the results as a string return value# from curl_exec() instead of the usual true/false.curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);// EXECUTE 1st REQUEST (FORM LOGIN)$store = curl_exec ($ch);[b]// SET FILE TO DOWNLOADcurl_setopt($ch, CURLOPT_URL, 'http://http://ww1.external-site.com/rg-erdr.php?_rpo=t;);[/b]// EXECUTE 2nd REQUEST (FILE DOWNLOAD)$content = curl_exec ($ch);// CLOSE CURLcurl_close ($ch); ?> Your error is in the download URL. Your trying to download a file from a page you haven't logged into Share this post Link to post Share on other sites
iGuest 3 Report post Posted November 27, 2011 I am having getting the script to work, and I think it is due to my username. My username contains both the "@" and "." symbol.For the "@" I understand I can use %40, however what is the value I should use for "."the value i am trying to pass is email_name@domain.com Share this post Link to post Share on other sites
iGuest 3 Report post Posted February 12, 2012 Hello. I have tried for two days to get this working, but I can't quite do it. Please help.You can log into the site I want to get info from by going to this URL:website.ordIt then redirects you to the home page (https://www.website.com/)This is the code I am using: <?php// INIT CURL$ch = curl_init();// SET URL FOR THE POST FORM LOGINcurl_setopt($ch, CURLOPT_URL, 'https://http://forums.xisto.com/no_longer_exists/;);// ENABLE HTTP POSTcurl_setopt ($ch, CURLOPT_POST, 1);// SET POST PARAMETERS : FORM VALUES FOR EACH FIELDcurl_setopt ($ch, CURLOPT_POSTFIELDS, 'username=admin@othersite.com&password=123password');// IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIEScurl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');# Setting CURLOPT_RETURNTRANSFER variable to 1 will force cURL# not to print out the results of its query.# Instead, it will return the results as a string return value# from curl_exec() instead of the usual true/false.curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);// EXECUTE 1st REQUEST (FORM LOGIN)$store = curl_exec ($ch);echo "store: " . $store . "<br />";// SET FILE TO DOWNLOADcurl_setopt($ch, CURLOPT_URL, 'http://forums.xisto.com/no_longer_exists/;);// EXECUTE 2nd REQUEST (FILE DOWNLOAD)$content = curl_exec ($ch);echo "content: " . $content . "<br />";// CLOSE CURLcurl_close ($ch);?> The result is just a blank page (or store: content: with my 'echo's in the code).Any help appreciated! Thanks Share this post Link to post Share on other sites