Rifts Posted June 3, 2011 Share Posted June 3, 2011 Hey Guys! I have never used curl before but I have a little knowledge of it. Before I embark on this small project I have a quick question. What I'm trying to do is this; use curl to login into my utility bill website and grab the new total of my bill then email me the total. Is it possible using curl to grab info like that? Are there limitations as to certain sites curl can and cannot log into? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/238323-a-little-curl-help/ Share on other sites More sharing options...
Kieran Menor Posted June 3, 2011 Share Posted June 3, 2011 That should be perfectly possible, yes. Quote Link to comment https://forums.phpfreaks.com/topic/238323-a-little-curl-help/#findComment-1224776 Share on other sites More sharing options...
Rifts Posted June 3, 2011 Author Share Posted June 3, 2011 awesome thanks I'm googling a tutorial for this. If you know any off the top of your head let me know. thanks Quote Link to comment https://forums.phpfreaks.com/topic/238323-a-little-curl-help/#findComment-1224797 Share on other sites More sharing options...
Kieran Menor Posted June 3, 2011 Share Posted June 3, 2011 I don't, sorry, but feel free to ask if you get stuck. Quote Link to comment https://forums.phpfreaks.com/topic/238323-a-little-curl-help/#findComment-1224800 Share on other sites More sharing options...
Rifts Posted June 4, 2011 Author Share Posted June 4, 2011 ok so i'm using this code: <?php // INIT CURL $ch = curl_init(); // SET URL FOR THE POST FORM LOGIN curl_setopt($ch, CURLOPT_URL, 'https://www.aps.com/'); // ENABLE HTTP POST curl_setopt ($ch, CURLOPT_POST, 1); // SET POST PARAMETERS : FORM VALUES FOR EACH FIELD curl_setopt ($ch, CURLOPT_POSTFIELDS, 'username=mylogin&passoword=mypassword'); // IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIES curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); // EXECUTE 1st REQUEST $store = curl_exec ($ch); // CLOSE CURL curl_close ($ch); ?> Now when I run this i just get a blank screen. How do I know if its logging in or not? Also lets pretend it does login, how can I grab a value from the page it logged into? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/238323-a-little-curl-help/#findComment-1225154 Share on other sites More sharing options...
Rifts Posted June 4, 2011 Author Share Posted June 4, 2011 bump =] Quote Link to comment https://forums.phpfreaks.com/topic/238323-a-little-curl-help/#findComment-1225232 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.