jjk2 Posted May 28, 2008 Share Posted May 28, 2008 i am able to login successfully using curl to my favorite site forums.asdf.com however, i can only see the site by using printing the results in my localhost. is it possible to send the login, password to the actual forums.asdf.com so that i can directly begin browsing forums.asdf.com instead of using file_get_contents() each time ? this is highly inefficient. Link to comment https://forums.phpfreaks.com/topic/107715-using-curl-to-send-login-info-to-a-remote-site/ Share on other sites More sharing options...
DyslexicDog Posted May 28, 2008 Share Posted May 28, 2008 You should post the code you are using now. Without seeing the code, I can only ask 1 question. Have you tried echoing the return information? Link to comment https://forums.phpfreaks.com/topic/107715-using-curl-to-send-login-info-to-a-remote-site/#findComment-552199 Share on other sites More sharing options...
jjk2 Posted May 28, 2008 Author Share Posted May 28, 2008 no i am not interested in echoing the results.... the script works fine. it logs me in alright. but i would like to be redirected to the site where i am logged in....not echoing it back on my localhost because that consumes memory and a lot of bandwith. my question is, how can i directly send a POST with the http header containing username and password to the desired website. so i shouldn't need to echo or print any results, because after the POST, i will be logged in and already at the desired website. function hitForm($loginURL, $loginFields, $referer="") { $ch = curl_init(); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt"); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt"); curl_setopt($ch, CURLOPT_URL, $loginURL); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_REFERER, $referer); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $loginFields); $ret = curl_exec($ch); curl_close($ch); return $ret; } i would like a function to directly redirect me to the desired site and log me in. Link to comment https://forums.phpfreaks.com/topic/107715-using-curl-to-send-login-info-to-a-remote-site/#findComment-552207 Share on other sites More sharing options...
.josh Posted May 28, 2008 Share Posted May 28, 2008 I smell spambot. We don't help out on that sort of thing. Thread closed. You're welcome to PM me and appeal. Link to comment https://forums.phpfreaks.com/topic/107715-using-curl-to-send-login-info-to-a-remote-site/#findComment-552208 Share on other sites More sharing options...
Recommended Posts