i have tried every possible combination
i could think off
i have commented out and uncommented
every combination i could think of ....
the verbose mode does nothing .. nothing changes if its set to 1 or 0 .
dont really understand why the curl debug does not work .
the only information i can get is if i print the array $info
this is the script right now with the second link disabled . i was just trying to get
it to login first.
all i get with this is the websites login page ... no failed login or anything . almost like nothing is being sent . just the login page .... does not matter how i change it ...
Code: Select all
<?php
// INIT CURL
$ch = curl_init();
# // use this option to output all the exchanged info for trying to see what is happening
curl_setopt($ch, CURLOPT_VERBOSE, 1);
// SET URL FOR THE POST FORM LOGIN
curl_setopt($ch, CURLOPT_URL, 'https://www.somesite.com/DealerLogin.asp');
# // This is occassionally required to stop CURL from verifying the peer's certificate. for https connections
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); //sometimes needs to be 0 or 1...
#
// ENABLE HTTP POST
curl_setopt ($ch, CURLOPT_POST, 1);
// SET POST PARAMETERS : FORM VALUES FOR EACH FIELD
$user="some@domain.com";
$pass="1password";
$fields = 'username='.urlencode($user).'&password='.urlencode($pass);
//curl_setopt ($ch, CURLOPT_POSTFIELDS, 'username=some@domain.com&password=1password');
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
# //sometimes the post method doesn't work for logins and this does
//curl_setopt($ch, CURLOPT_USERPWD, 'some@domain.com:1password'); // example:'myusername:secretpass'
#
# //negociate the best HTTP authentication method(s)
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt($ch, CURLOPT_REFERER, 'https://www.somesite.com/DealerLogin.asp');
#curl_setopt($ch, CURLOPT_HEADER, 1);
// IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIES
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
# //the following might be all you need
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // often not set by default, this will recursively follow all redirect headers
#
# 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);
# //use this after a curl_exec to extract http codes
# //and lots of info as documented here
# //http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html
# //not probably needed if in verbose mode for debugging
$info=curl_getinfo($ch);//get debugging info on last call
print_r($info);
// SET FILE TO DOWNLOAD
//curl_setopt($ch, CURLOPT_URL, 'http://www.somesite.com/Reseller/Feeds/GetDataFeed.asp?type=csv');
// EXECUTE 2nd REQUEST (FILE DOWNLOAD)
//$content = curl_exec ($ch);
// CLOSE CURL
curl_close ($ch);
?>
here is what is printed using the print_r ;
Code: Select all
Array ( [url] => https://www.somesite.com/DealerLogin.asp [content_type] => text/html; charset=utf-8 [http_code] => 200 [header_size] => 713 [request_size] => 295 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 1.542275 [namelookup_time] => 0.718569 [connect_time] => 0.791108 [pretransfer_time] => 1.11707 [size_upload] => 48 [size_download] => 15484 [speed_download] => 10039 [speed_upload] => 31 [download_content_length] => 15484 [upload_content_length] => -1 [starttransfer_time] => 1.388848 [redirect_time] => 0 )
I can not get this to do anything no matter where i put it :
Code: Select all
curl_setopt($ch, CURLOPT_VERBOSE, 1);
any ideas?