amleszk / appdailysales

Automatically exported from code.google.com/p/appdailysales
0 stars 0 forks source link

PHP Version #28

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hey,

I have set out to port this great script to PHP and there are a few problems 
I'm having so could you please help with some parts.

I started out with this script that logs into itunesconnect fine

<?php
$user = "myusername@fakeguy.com";
$pass = "hahanobodyknows";

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, 
"https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa"); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
$output = curl_exec($ch); 
curl_close($ch); 

$num = substr($output, strrpos($output,'action="')+8,54);

extract($_POST);
$url = 'https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/wo/'.$num;
$fields = array( 
            'theAccountName'=>urlencode($user),
            'theAccountPW'=>urlencode($pass),
            '1.Continue'=>urlencode('0'),
        );
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } 
rtrim($fields_string,'&');
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
$result = curl_exec($ch);
curl_close($ch);

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, "https://reportingitc.apple.com/"); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
$output = curl_exec($ch); 
curl_close($ch); 
?>

The problem is the last section where it gets html from 
"https://reportingitc.apple.com/" which strangely returns nothing

I have tried to follow the python version as close as possible and there may 
have been something missed out

Any ideas?
Thanks

Original issue reported on code.google.com by ad...@vmlweb.co.uk on 31 Oct 2010 at 12:27

GoogleCodeExporter commented 8 years ago
If the user has not been authenticated and the appropriate cookies saved then 
https://reportingitc.apple.com/ will return a blank HTML, i.e., nothing.  

When using curl with PHP, are cookies retained between each call?  If not then 
you will want to make sure cookies are saved.  

Also, troegenator pointed out in issue 25 
(http://code.google.com/p/appdailysales/issues/detail?id=25&can=1) that RFC2965 
cookie support is required. I have not researched this further but the fix did 
solve the problem someone had reaching the vendor page.

Hope this helps.

-KIRBY

Original comment by kirbyt.w...@gmail.com on 31 Oct 2010 at 5:51

GoogleCodeExporter commented 8 years ago
Hey,

Did you ever get the PHP version working. Would it be possible to get the code ?

Regards,
Stephen

Original comment by stephenx...@gmail.com on 7 Jun 2011 at 1:27

GoogleCodeExporter commented 8 years ago
also intereste in the PHP version! would be nice if you share. maybe I can help 
you finishing it?

Original comment by goo...@headkit-games.com on 20 Jun 2011 at 3:53

GoogleCodeExporter commented 8 years ago
After I transfered to appfigures I didn't need this script any more and I gave 
up.

Original comment by ad...@vmlweb.co.uk on 20 Jun 2011 at 4:03