MyEpisodes Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

cURL + PHP + update watched/acquired shows

 
Post new topic   Reply to topic    MyEpisodes Forum Index -> Developers
View previous topic :: View next topic  
Author Message
imthenachoman


Posts: 2

PostPosted: Sat Aug 08, 2009 5:27 am    Post subject: cURL + PHP + update watched/acquired shows Reply with quote

I was hoping someone might be to help me with something.

I have figured out how to use cURL + PHP to login (and save my cookies) to myepisodes.com and then get data from different parts of the sites like the views.php part. What I can't figure out is why when I try to update watched/acquired data, it won't work.

Code:

<?php

// initialize curl
$curl = curl_init();
// return data, don't print
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1 );
// follow re-directs
curl_setopt( $curl, CURLOPT_FOLLOWLOCATION, 1 );

// post data
$post = array(
    'username' => 'imthenachoman',
    'password' => 'password',
    'u' => '',
    'action' => 'Login',
);


//login page url
curl_setopt( $curl, CURLOPT_URL, 'http://www.myepisodes.com/login.php' );
// send post data
curl_setopt( $curl, CURLOPT_POST, 1 );
// post data
curl_setopt( $curl, CURLOPT_POSTFIELDS, http_build_query( $post ) );
// save to cookie file
curl_setopt( $curl, CURLOPT_COOKIEJAR, 'test' );

$result = curl_exec( $curl );

// confirm logged in
if( preg_match( '/imthenachoman/i', $result ) )
{
    print 'logged in' . "\n";
}
else
{
    print 'not logged in' . "\n";
}

curl_setopt( $curl, CURLOPT_URL, 'http://www.myepisodes.com/shows.php?type=manage' );
curl_setopt( $curl, CURLOPT_POST, 0 );

$result = curl_exec( $curl );

// this prints my shows list
print $result;

?>


Everything works fine up to this point.

Code:

<?

// build new post string to update show id = 3156, season = 2, episode = 6
// not including A3156-2-6, or V3156-2-6 so it should mark this episode as un-acquired
$post = array(
    'returnaddress' => '/views.php?',
    'checkboxes' => '3156-2-6',
    'action' => 'Save Status',
);

curl_setopt( $curl, CURLOPT_URL, 'http://myepisodes.com/views.php?type=save' );
curl_setopt( $curl, CURLOPT_POSTFIELDS, http_build_query( $post ) );

$result = curl_exec( $curl );

// but this prints the login page and it doesn't update show status as expected
print $result;

curl_close( $curl );

?>


The last part prints the login page. :'(

Any ideas anyone?
Back to top
View user's profile Send private message
IceMan
Founder
Founder

Posts: 611
Location: Denmark

PostPosted: Tue Aug 11, 2009 7:55 pm    Post subject: Reply with quote

Has been moved. Smile
Back to top
View user's profile Send private message Visit poster's website
Fraak


Posts: 1

PostPosted: Wed Apr 07, 2010 6:58 pm    Post subject: Reply with quote

Try using the zend framework: Zend_Http_Client
Back to top
View user's profile Send private message
IceMan
Founder
Founder

Posts: 611
Location: Denmark

PostPosted: Wed Apr 07, 2010 9:03 pm    Post subject: Reply with quote

If you get the login page again, then you are not preserving the cookie state correctly.
Back to top
View user's profile Send private message Visit poster's website
aEnigma


Posts: 2

PostPosted: Mon May 10, 2010 4:24 pm    Post subject: Reply with quote

the problem is that the cookies are set during the header-location-change-response (status code 302 found)

most request-handler automatically get the linked webpage overwriting the cookies returned.

POST Request: login.php
Response: 302 Found myshows.php (+ login.php head -> cookies)
GET Request: myshows.php
Response: 200 (myshows.php head -> cookies & body data)[/quote]
Back to top
View user's profile Send private message
aciidb0mb3r


Posts: 5

PostPosted: Tue Mar 08, 2011 8:05 am    Post subject: Reply with quote

http://www.myepisodes.com/forum/viewtopic.php?t=1318
the php script i made has code to update watched/acquired...
Back to top
View user's profile Send private message
nikkij


Posts: 1

PostPosted: Thu Feb 21, 2019 7:46 am    Post subject: Reply with quote

There might be some issue in the source code which can be resolved from https://errorcode0x.com/resolve-steam-error-code-80/
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    MyEpisodes Forum Index -> Developers All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

Main design by MW. Refitted to board by Hostile.