473,320 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

cUrl problem

Hey there, if it would be possible, since you have figured out the login function of logging into yahoo from PHP CURL, could you post that solution? I'm having quite a time figuring that out.........

here is my code:
[php]
<?

$c=curl_init();
curl_setopt($c, CURLOPT_USERAGENT, "BiogetBot");
curl_setopt($c, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($c, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($c, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($c, CURLOPT_HEADER , TRUE);
curl_setopt($c, CURLOPT_COOKIEJAR, dirname(__FILE__).'/cookie.txt');
curl_setopt($c, CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookie.txt');
curl_setopt($c, CURLOPT_URL, "https://login.yahoo.com");
$html=curl_exec($c);
curl_close($c);
unset($c);

////////////
// Get URL
//
preg_match("/action=\"([\S]*)\" /", $html, $action);
$url = $action[1];

///////////////////////
// Get Params to pass
//
preg_match_all("/<input type=\"hidden\" name=\"(.*)\" value=\"(.*)\">/", $html, $hidden_vars);

$params = array();

foreach($hidden_vars[1] as $index => $name)
$params[$name] = $hidden_vars[2][$index];

$params['.done'] = "http://basketball.fantasysports.yahoo.com/nba/38554";
$params['.persistent'] = "y";
$params['.save'] = "Sign In";
$params['login'] = $user;
$params['passwd'] = $pass;

$c=curl_init();
curl_setopt($c, CURLOPT_USERAGENT, "BiogetBot");
curl_setopt($c, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($c, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($c, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($c, CURLOPT_HEADER , TRUE);
curl_setopt($c, CURLOPT_COOKIEJAR, dirname(__FILE__).'/cookie.txt');
curl_setopt($c, CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookie.txt');
curl_setopt($c, CURLOPT_URL, $url);
curl_setopt($c, CURLOPT_POST, TRUE);
curl_setopt($c, CURLOPT_POSTFIELDS, implode("&", $params));
$html=curl_exec($c);
curl_close($c);

?>[/php]


THANKS!

You must enclose all code within the appropriate code tags!! Read the Posting Guidelnes on that. - moderator
Mar 4 '08 #1
1 1355
ronverdonk
4,258 Expert 4TB
This thread has been split of because you were hijacking another thread!! That is strictly forbidden, see the Posting Guidelines.

Also, enclose any code you show within the appropriate coding tags.

moderator
Mar 4 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: D Benfer | last post by:
Hi all, Im a bit thrown by curl. I want to submit some order data on an ecommerce site via a form to a php page, where the data is saved to a database. Then I want to use curl to submit the form...
1
by: machodev | last post by:
Hello Friends, Getting a bit fuzzy on the Authorize.net and the Curl Integration. I have the script using the for the authorize.net Integration with the curl command exec("/usr/local/bin -m...
1
by: Haluk Durmus | last post by:
Hello I checked out openssl,mm,apr,apr-util,apache 2,curl,libxml and php from cvs. php couse an ERROR I did the following steps:
9
by: Dave Martin | last post by:
I've successfully used CURL to maneuver around and through sites but a new site I've been trying to work with has got me stumped. To retrieve the data I'm trying to get a login is required. If...
9
by: Conrad F | last post by:
Hi, If any Microsoft people are listening.... Are there any plans for the new web language called "Curl" to be supported in .NET (ASP.NET)? I ask as Curl represents the first step to true OO...
6
by: Wescotte | last post by:
I'm writing a tiny php app that will log into our bank of america account and retrieve a file containing a list of checks that cleared the previous day. The problem I'm running into is when I...
4
by: zorro | last post by:
Hello there, I can't figure out why is it that when i use an array for my postfields it doesn't work : this works curl_setopt($curl, CURLOPT_POSTFIELDS, "clown=bozo" ); this doesn't...
1
by: c1pkw | last post by:
Hi there, I’m having a real heap of trouble with PHP and cURL My aim is to use this code (or something like it) to submit 2 fields to a remote server (using GET) and receive back 6 fields...
11
by: Flexor | last post by:
I have a php script that runs from command line and makes an https request to paypal, using curl. It works fine if I run it from a web page. It fails if I run it from CLI. The error I get from...
3
by: Sarah | last post by:
I was wondering if someone might be able to help me with this issue. I have a feeling this has something to do with my host's server settings as I used to be able to get CURL to follow redirects by...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.