943,712 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 7213
  • PHP RSS
Sep 5th, 2009
0

login at youtube using cURL and php ?

Expand Post »
Hello. I'm quite a newbie to cURL and php. I have been trying hard to login at youtube using cURL but haven't had any success.

All i get in return when i run the following code is the youtube login page, with my username(which i used in the code) written at the username Field and it doesn't login.

Can anyone tell me what's goin on ?

php Syntax (Toggle Plain Text)
  1. <?php
  2.  
  3. $posturl = '&GALX=obiRBhLUBIa&Email=myfancyusername@gmail.com&Passwd=myfancypassword&rmShown=1&signIn=Sign+in&asts=';
  4.  
  5. $ch = curl_init();
  6. curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookieYoutube");
  7. curl_setopt($ch, CURLOPT_URL,"https://www.google.com/accounts/ServiceLogin?service=youtube");
  8. curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
  9. curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/x-www-form-urlencoded"));
  10. curl_setopt($ch, CURLOPT_POST, 1);
  11. curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/cookieYoutube");
  12. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false );
  13. curl_setopt($ch, CURLOPT_REFERER,"https://www.google.com/accounts/ServiceLogin?service=youtube");
  14. curl_setopt($ch, CURLOPT_POSTFIELDS, $posturl);
  15.  
  16.  
  17. $output = curl_exec ($ch);
  18.  
  19. curl_close($ch);
  20.  
  21. echo $output;
  22.  
  23. ?>
Reputation Points: 10
Solved Threads: 0
Newbie Poster
phpboy is offline Offline
10 posts
since Jun 2009
Sep 7th, 2009
0

Re: login at youtube using cURL and php ?

can someone at least tell me if it's possible or not ?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
phpboy is offline Offline
10 posts
since Jun 2009
Sep 24th, 2009
0

Re: login at youtube using cURL and php ?

I have made an app to login to youtube in VB and it worked fine.

Instead of ServiceLogin, use ServiceLoginAuth

should work. Could you come to expertcore org to discuss on this?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
thisara is offline Offline
4 posts
since Sep 2009
Sep 25th, 2009
0

Re: login at youtube using cURL and php ?

Click to Expand / Collapse  Quote originally posted by phpboy ...
can someone at least tell me if it's possible or not ?
You should be able to if you send the right HTTP request. Since the login page is under HTTPS, observing the HTTP request is not straight forward.

What are you using to look at the HTTP request, if any? Or are you just creating the request based on the login form?
Moderator
Reputation Points: 457
Solved Threads: 101
Nearly a Posting Virtuoso
digital-ether is offline Offline
1,250 posts
since Sep 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: not a valid MySQL result resource
Next Thread in PHP Forum Timeline: Problem with Serial Number in PHP





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC