Jump to content

prady

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

prady's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. one more error when i run this code is HTTP 301 error not allowed.....something like that...
  2. code 1 <?php $username = "username"; $password = "password"; // Initialise cURL $c = curl_init('https://www.google.com/accounts/ServiceLogin?service=mail&passive=true&rm=false&continue=http%3A%2F%2Fmail.google.com%2Fmail%2F%3Fui%3Dhtml%26zy%3Dl&bsv=zpwhtygjntrz&scc=1&ltmpl=default&ltmplcache=2 '); $headers = array( "Host: gmail.com", "Email:$username", "Passwd:$password", "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4", "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Language: en-us,en;q=0.5", "Accept-Encoding: gzip,deflate,html", "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7", "Keep-Alive: 300", "Connection: keep-alive"); curl_setopt($c, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($c, CURLOPT_COOKIESESSION, true); curl_setopt($c, CURLOPT_HTTPHEADER, $headers); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($c, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 1); curl_setopt($c, CURLOPT_UNRESTRICTED_AUTH, 1); curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 1); curl_setopt($c, CURLOPT_TIMEOUT, 7); // time out after 3s curl_setopt($c, CURLOPT_MAXREDIRS, 4); $str = curl_exec($c); echo $str; curl_close($c); ?> this is the first set of code {not working) (i changed the username and password) code 2 <?php> $login = "https://www.google.com/accounts/ServiceLoginAuth?service=mail"; $c = curl_init(); curl_setopt($c, CURLOPT_URL, $login); curl_setopt($c, CURLOPT_COOKIEJAR, "cookies.txt"); curl_setopt($c, CURLOPT_COOKIEFILE, "cookies.txt"); curl_setopt($c, CURLOPT_POST, 1); curl_setopt($c, CURLOPT_POSTFIELDS, "Email=',myusername'& Passwd='mypassord'& continue='http://mail.google.com/mail/?ui=html&zy=l'& service='mail'& rm='false'& ltmpl='false'& h1='en'& ltmpl='default'& scc='1'& GALX='8eKZr_QRh9E'"); curl_setopt($c, CURLOPT_RANGE, "0-4096"); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); // return to var curl_setopt($c, CURLOPT_FAILONERROR, 1); // dont hang curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1); // allow redirects curl_setopt($c, CURLOPT_TIMEOUT, 7); // time out after 3s curl_setopt($c, CURLOPT_HEADER, 0); curl_setopt($c, CURLOPT_MAXREDIRS, 4); $login_done = curl_exec($c); echo $login_done; ?> this is the second set of code, even this is nt working code 3 <?php $ch = curl_init(); $username='myusername'; $password='mypassword'; $postdata="Email=$username&Passwd=$password&continue=https://www.mail.google.com"; curl_setopt ($ch, CURLOPT_URL,"https://www.mail.google.com"); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); curl_setopt ($ch, CURLOPT_TIMEOUT, 60); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_COOKIEJAR, $gacookie); curl_setopt ($ch, CURLOPT_COOKIEFILE, $gacookie); curl_setopt ($ch, CURLOPT_REFERER, "https://www.gmail.com"); curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata); curl_setopt ($ch, CURLOPT_POST, 1); $AskApache_result = curl_exec ($ch); curl_close($ch); unlink($gacookie); ?> This is code 3, this is not working as well Code 4 ?php // Initialise cURL $c = curl_init('https://www.google.com/accounts/ServiceLoginAuth?service=mail'); $headers = array( Email:myusername, Passwd:mypassword, continue:http://mail.google.com/mail/?ui=html&zy=l, service:mail, rm:false, ltmpl:false, h1:en, ltmpl:default, scc:1, GALX:8eKZr_QRh9E, Host: ocsp.thawte.com:80, User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4, Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/;q=0.8, Accept-Language: en-us,en;q=0.5, Accept-Encoding: gzip,deflate, Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7, Keep-Alive: 300, Connection: keep-alive, Content-Length: 115, Content-Type: application/ocsp-request 0q0o0M0K0I0+ ); curl_setopt($c, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($c, CURLOPT_COOKIESESSION, true); curl_setopt($c, CURLOPT_HTTPHEADER, $headers); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($c, CURLOPT_RANGE, "0-4096"); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_FAILONERROR, 1); curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($c, CURLOPT_TIMEOUT, 7); curl_setopt($c, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 1); curl_setopt($c, CURLOPT_UNRESTRICTED_AUTH, 1); curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 1); $str = curl_exec($c); echo $str; curl_close($c); ?> this is code 4, this is not working as well... I don't know, what to do..i have tried every possibililty.
  3. no no, i need something that i can take as a sample.... gmail yahoo orkut nething wud do... i l read it and understand how it works... thats all.. i have been scratching myhead onthis for abt a week now.. none of my codes seem to work
  4. can u gimme a sample curl php code to login to any mailserver.
  5. <?php> $login = "https://www.google.com/accounts/ServiceLoginAuth?service=mail"; $c = curl_init(); curl_setopt($c, CURLOPT_URL, $login); curl_setopt($c, CURLOPT_COOKIEJAR, "cookies.txt"); curl_setopt($c, CURLOPT_COOKIEFILE, "cookies.txt"); curl_setopt($c, CURLOPT_POST, 1); curl_setopt($c, CURLOPT_POSTFIELDS, "Email='ppradeepkumar2006'& Passwd='puppyhead'& continue='http://mail.google.com/mail/?ui=html&zy=l'& service='mail'& rm='false'& ltmpl='false'& h1='en'& ltmpl='default'& scc='1'& GALX='8eKZr_QRh9E'"); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($c, CURLOPT_URL, $url); curl_setopt($c, CURLOPT_RANGE, "0-4096"); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); // return to var curl_setopt($c, CURLOPT_FAILONERROR, 1); // dont hang curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1); // allow redirects curl_setopt($c, CURLOPT_TIMEOUT, 3); // time out after 3s curl_setopt($c, CURLOPT_HEADER, 0); $login_done = curl_exec($c); echo $login_done; ?> i tried to find the fields in gmail's source HTML file..i added the fields whichever was missing. but still im not able to pass thru
  6. <?php> $login = "https://www.google.com/accounts/ServiceLoginAuth?service=mail"; $c = curl_init(); curl_setopt($c, CURLOPT_URL, $login); curl_setopt($c, CURLOPT_COOKIEJAR, "cookies.txt"); curl_setopt($c, CURLOPT_COOKIEFILE, "cookies.txt"); curl_setopt($c, CURLOPT_POST, 1); curl_setopt($c, CURLOPT_POSTFIELDS, "username=myusername&password=mypassword"); curl_setopt($c, CURLOPT_RANGE, "0-4096"); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); // return to var curl_setopt($c, CURLOPT_FAILONERROR, 1); // dont hang curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1); // allow redirects curl_setopt($c, CURLOPT_TIMEOUT, 3); // time out after 3s curl_setopt($c, CURLOPT_HEADER, 0); $login_done = curl_exec($c); ?> all i get is a blank page after that, when clicked. But i tried a different URL and it works that time. But for gmail it is not working. can anyone tell me what is wrong with this code
  7. <?php> $login = "https://www.google.com/accounts/ServiceLoginAuth?service=mail"; $c = curl_init(); curl_setopt($c, CURLOPT_URL, $login); curl_setopt($c, CURLOPT_COOKIEJAR, "cookies.txt"); curl_setopt($c, CURLOPT_COOKIEFILE, "cookies.txt"); curl_setopt($c, CURLOPT_POST, 1); curl_setopt($c, CURLOPT_POSTFIELDS, "username=myusername&password=mypassword"); curl_setopt($c, CURLOPT_RANGE, "0-4096"); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); // return to var curl_setopt($c, CURLOPT_FAILONERROR, 1); // dont hang curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1); // allow redirects curl_setopt($c, CURLOPT_TIMEOUT, 3); // time out after 3s curl_setopt($c, CURLOPT_HEADER, 0); $login_done = curl_exec($c); ?> i want to login to gmail using curl php. the code works for some other account; But i m not able to use it for gmail . I want to see the inbox. that is after logging in thru this
  8. tell me how to send username and password to a gmail server using the php codes
  9. Im doing a project now in PHP. I have a common portal page for orkut, gmail, facebook and yahoo. and the username and password are static i.e. i wont be changing it at all. I have stored it in 4 new session variables what im suppose to do is that, 1) when i click the image of (say) gmail, it shud directly use the username and password which I have stored and directly login to to the inbox signed page, it shudnt prompt me for a username and password. im a rookie in this. can u guys please help me??? thanks
×
×
  • 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.