Array
(
[txn_type] => subscr_signup
[subscr_id] => I-WT2XTR8FF1NX
[last_name] => testing
[residence_country] => US
[mc_currency] => USD
[item_name] => ilookin's monthly
[business] => indhumathi.k-facilitator#optisolbusiness.com
[amount3] => 1.00
[recurring] => 0
[address_street] => 1 Main St
[payer_status] => verified
[payer_email] => optisol#optisol.com
[address_status] => confirmed
[first_name] => optisol
[receiver_email] => indhumathi.k-facilitator#optisolbusiness.com
[address_country_code] => US
[payer_id] => QUMFGMGW2N4Z2
[address_city] => San Jose
[reattempt] => 1
[address_state] => CA
[subscr_date] => 01:29:58 Apr 19, 2016 PDT
[address_zip] => 95131
[charset] => windows-1252
[address_country] => United States
[period3] => 1 M
[mc_amount3] => 1.00
[address_name] => optisol testing
[auth] => A0LUGRBFj6LNkWG.xKRjssSW6CnDDxfiPEt6gNkXkpQz7wuKMdiuZAm3B56YywWHBW9Hjc07tetTpy8sD8YAMdQ
[form_charset] => UTF-8
[EC-1A5481165X7875926] =>
)
Am getting these parameters.But I need token after the success completion of recurring subscription.How to get it after the payment success?
Please Advice
Thanks in Advance.
Related
Steps I am following.
I am sending the authenticate parameter as 1 to public.php file and recieving the oauth_token and oauth_token_secret.
http://localhost/XeroOAuth-PHP-master/public.php?authenticate=1
Here at this stage session is generated as below
Array
(
[oauth] => Array
(
[oauth_token] => XXX
[oauth_token_secret] => XXX
[oauth_callback_confirmed] => true
)
)
Next step, I am calling this url http://localhost/XeroOAuth-PHP-master/public.php?oauth_verifier=1&oauth_token=3CHDO7HFISTMVJXDX7IIPMRJUZH2FC
At this stage it throws below error, which says permission_denied.
Error: oauth_problem=permission_denied&oauth_problem_advice=The%20consumer%20was%20denied%20access%20to%20this%20resource.
Below is the entire Error format I receive in the page.
XeroOAuth Object
(
[_xero_defaults] => Array
(
[xero_url] => https://api.xero.com/
[site] => https://api.xero.com
[authorize_url] => https://api.xero.com/oauth/Authorize
[signature_method] => HMAC-SHA1
)
[_xero_consumer_options] => Array
(
[request_token_path] => oauth/RequestToken
[access_token_path] => oauth/AccessToken
[authorize_path] => oauth/Authorize
)
[_action] =>
[_nonce_chars] =>
[params] => Array
(
)
[headers] => Array
(
[Accept] => application/xml
[Content-Length] => 0
[Expect] =>
)
[auto_fixed_time] =>
[buffer] =>
[request_params] => Array
(
)
[_xero_curl_options] => Array
(
[curl_connecttimeout] => 30
[curl_timeout] => 20
[curl_ssl_verifypeer] => 2
[curl_cainfo] => C:\xampp\htdocs\XeroOAuth-PHP-master/certs/ca-bundle.crt
[curl_followlocation] =>
[curl_ssl_verifyhost] => 2
[curl_proxy] =>
[curl_proxyuserpwd] =>
[curl_encoding] =>
[curl_verbose] => 1
)
[config] => Array
(
[xero_url] => https://api.xero.com/
[site] => https://api.xero.com
[authorize_url] => https://api.xero.com/oauth/Authorize
[signature_method] => HMAC-SHA1
[request_token_path] => oauth/RequestToken
[access_token_path] => oauth/AccessToken
[authorize_path] => oauth/Authorize
[curl_connecttimeout] => 30
[curl_timeout] => 20
[curl_ssl_verifypeer] => 2
[curl_cainfo] => C:\xampp\htdocs\XeroOAuth-PHP-master/certs/ca-bundle.crt
[curl_followlocation] =>
[curl_ssl_verifyhost] => 2
[curl_proxy] =>
[curl_proxyuserpwd] =>
[curl_encoding] =>
[curl_verbose] => 1
[application_type] => Public
[oauth_callback] => localhost
[user_agent] => Xero-OAuth-PHP Public
[consumer_key] => XXX
[shared_secret] => XXX
[core_version] => 2.0
[payroll_version] => 1.0
[file_version] => 1.0
[access_token] => XXX
[access_token_secret] => XXX
[host] => https://api.xero.com/oauth/
[multipart] =>
)
[method] => GET
[url] => https://api.xero.com/oauth/AccessToken
[sign] => Array
(
[parameters] => Array
(
[oauth_consumer_key] => YDOVURHNHW7RIHJ384ZYJ7TMVQT8W7
[oauth_nonce] => Ubrb
[oauth_signature_method] => HMAC-SHA1
[oauth_timestamp] => 1504002299
[oauth_token] => 3CHDO7HFISTMVJXDX7IIPMRJUZH2FC
[oauth_verifier] => 1
[oauth_version] => 1.0
[oauth_signature] => o9ucXeTTvA04tQgLTBX5AuMoX2Y=
)
[signature] => o9ucXeTTvA04tQgLTBX5AuMoX2Y%3D
[signed_url] => https://api.xero.com/oauth/AccessToken?oauth_consumer_key=YDOVURHNHW7RIHJ384ZYJ7TMVQT8W7&oauth_nonce=Ubrb&oauth_signature=o9ucXeTTvA04tQgLTBX5AuMoX2Y%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1504002299&oauth_token=3CHDO7HFISTMVJXDX7IIPMRJUZH2FC&oauth_verifier=1&oauth_version=1.0
[header] => OAuth oauth_consumer_key="YDOVURHNHW7RIHJ384ZYJ7TMVQT8W7", oauth_nonce="Ubrb", oauth_signature="o9ucXeTTvA04tQgLTBX5AuMoX2Y%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1504002299", oauth_token="3CHDO7HFISTMVJXDX7IIPMRJUZH2FC", oauth_verifier="1", oauth_version="1.0"
[sbs] => GET&https%3A%2F%2Fapi.xero.com%2Foauth%2FAccessToken&oauth_consumer_key%3DYDOVURHNHW7RIHJ384ZYJ7TMVQT8W7%26oauth_nonce%3DUbrb%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1504002299%26oauth_token%3D3CHDO7HFISTMVJXDX7IIPMRJUZH2FC%26oauth_verifier%3D1%26oauth_version%3D1.0
)
[format] => xml
[response] => Array
(
[headers] => Array
(
[cache_control] => private
[content_type] => text/html; charset=utf-8
[date] => Tue, 29 Aug 2017 10:25:01 GMT
[strict_transport_security] => max-age=31536000
[www_authenticate] => OAuth Realm="10.144.115.64"
[content_length] => 115
[connection] => keep-alive
)
[code] => 401
[response] => oauth_problem=permission_denied&oauth_problem_advice=The%20consumer%20was%20denied%20access%20to%20this%20resource.
[info] => Array
(
[url] => https://api.xero.com/oauth/AccessToken?oauth_consumer_key=YDOVURHNHW7RIHJ384ZYJ7TMVQT8W7&oauth_nonce=Ubrb&oauth_signature=o9ucXeTTvA04tQgLTBX5AuMoX2Y%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1504002299&oauth_token=3CHDO7HFISTMVJXDX7IIPMRJUZH2FC&oauth_verifier=1&oauth_version=1.0
[content_type] => text/html; charset=utf-8
[http_code] => 401
[header_size] => 267
[request_size] => 418
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 1.438
[namelookup_time] => 0
[connect_time] => 0.328
[pretransfer_time] => 1.016
[size_upload] => 0
[size_download] => 115
[speed_download] => 79
[speed_upload] => 0
[download_content_length] => 115
[upload_content_length] => -1
[starttransfer_time] => 1.438
[redirect_time] => 0
[redirect_url] =>
[primary_ip] => 54.209.35.242
[certinfo] => Array
(
)
[primary_port] => 443
[local_ip] => 192.168.1.35
[local_port] => 60675
[request_header] => GET /oauth/AccessToken?oauth_consumer_key=YDOVURHNHW7RIHJ384ZYJ7TMVQT8W7&oauth_nonce=Ubrb&oauth_signature=o9ucXeTTvA04tQgLTBX5AuMoX2Y%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1504002299&oauth_token=3CHDO7HFISTMVJXDX7IIPMRJUZH2FC&oauth_verifier=1&oauth_version=1.0 HTTP/1.1
Host: api.xero.com
User-Agent: Xero-OAuth-PHP Public
Accept-Encoding: deflate, gzip
Accept: application/xml
Content-Length: 0
)
[format] => xml
)
)
This error is returned if you try to swap a request token for an access token when the access token hasn't yet been authorised for an organisation.
There should be a step in the flow of your application which redirects the user to https://api.xero.com/oauth/Authorize?oauth_token=[OAUTH_TOKEN_HERE] - once the Xero user has selected the organisation they're giving access to and given the ok, your second call should work.
I have some LDAP users in iTops, and i want to login with all of users in iTops. But i have an error like that "user not found in LDAP".
Which folders that i have to change ? So i can login with all LDAP users.
I appreciate for your responses, all of you. Please help me, thanks.
in config-itop.php
$MyModuleSettings = array(
'authent-ldap' => array (
'host' => '192.168.1.2',
'port' => 389,
'default_user' => 'anonim',
'default_pwd' => 'Admin123',
'base_dn' => 'dc=vokasiub,dc=COM',
'user_query' => '(samaccountname=%1$s)',
'options' => array (
17 => 3,
8 => 0,
),
'start_tls' => false,
'debug' => true,
),
'authent-ldap2' => array (
'host' => '192.168.2.2',
'port' => 389,
'default_user' => 'isoiso',
'default_pwd' => 'Admin123',
'base_dn' => 'ou=users ou, dc=bagusyekti,dc=COM',
'user_query' => '(samaccountname=%1$s)',
'options' => array (
17 => 3,
8 => 0,
),
'start_tls' => false,
'debug' => true,
),
'itop-attachments' => array (
'allowed_classes' => array (
0 => 'Ticket',
),
'position' => 'relations',
'preview_max_width' => 290,
),
'email-reply' => array (
'enabled_default' => true,
),
'itop-backup' => array (
'mysql_bindir' => '',
'week_days' => 'monday, tuesday, wednesday, thursday, friday',
'time' => '23:30',
'retention_count' => 5,
'enabled' => true,
'debug' => true,
),
);
iTop 2.7 and older
This was not possible.
iTop 3.0 and newer
This is now possible, check the full documentation here, but basically you have to set the different LDAP servers like this in the iTop configuration file:
'authent-ldap' => array (
'host' => 'localhost',
'port' => 389,
'default_user' => '',
'default_pwd' => '',
'base_dn' => 'dc=mycompany,dc=com',
'user_query' => '(&(uid=%1$s))',
'options' => array (
17 => 3,
8 => 0,
),
'debug' => false,
'servers' => array(
'MySecond-LDAP-Server' => array(
'host' => 'server1',
'port' => 389,
'default_user' => '',
'default_pwd' => '',
'base_dn' => 'dc=mycompany,dc=com',
'user_query' => '(&(uid=%1$s))',
'options' => array (
17 => 3,
8 => 0,
),
'debug' => false,
),
),
),
$criteria = new CDbCriteria;
$criteria->group = 't.blahah_id';
$result = new CActiveDataProvider('SocialnetworkSpams', array(
'criteria' => $criteria,
));
echo "<pre>";
print_r($result->getData());
Array
(
[0] => SocialnetworkSpams Object
(
[total] =>
[_new:CActiveRecord:private] =>
[_attributes:CActiveRecord:private] => Array
(
[id] => 1
[created_date] => 2015-12-04 03:50:47
[feedtype] => 1
[feedback] =>
[spam_status] => 1
[approveby_id] => 1
[blahah_id] => 1
[bunit_id] => 3
[spamby_id] => 1
)
[_related:CActiveRecord:private] => Array
(
)
[_c:CActiveRecord:private] =>
[_pk:CActiveRecord:private] => 1
[_alias:CActiveRecord:private] => t
[_errors:CModel:private] => Array
(
)
[_validators:CModel:private] =>
[_scenario:CModel:private] => update
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
[1] => SocialnetworkSpams Object
(
[total] =>
[_new:CActiveRecord:private] =>
[_attributes:CActiveRecord:private] => Array
(
[id] => 4
[created_date] => 2015-12-04 04:24:07
[feedtype] => 5
[feedback] => a
[spam_status] => 0
[approveby_id] =>
[blahah_id] => 2
[bunit_id] => 3
[spamby_id] => 1
)
[_related:CActiveRecord:private] => Array
(
)
[_c:CActiveRecord:private] =>
[_pk:CActiveRecord:private] => 4
[_alias:CActiveRecord:private] => t
[_errors:CModel:private] => Array
(
)
[_validators:CModel:private] =>
[_scenario:CModel:private] => update
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
)
I want duplicate record get using blahah id you can check bellow image:
Thanks
I have been resolved this issue.
$criteria = new CDbCriteria;
$criteria->select = '*, count(*) as total';
$criteria->group = 't.blahah_id';
return new CActiveDataProvider($this, array(
'criteria' => $criteria,
));
View Page :
$this->widget('zii.widgets.grid.CGridView', array(
'id' => 'spam-user-grid',
'itemsCssClass' => 'table table-striped table-bordered table-hover',
'dataProvider' => $model->search(),
'template' => "{items}{pager}",
'pager' => array(
'header' => '',
),
'columns' => array(
array(
'header' => 'Blahah',
'type' => 'raw',
'value' => 'ucfirst($data->ratingprofile->name)',
//'filter' => CHtml::textField('User[name]'),
),
array(
'header' => 'Total',
'type' => 'raw',
'value' => '$data->total',
),
),
)
));
I am trying to implement a business formula in QueryOver.
POorder.Estimate is a calculated field and I need to get
ToDateOrderAmount = POrder.Estimate - Sum(PODist.Field1) - Sum(PODisTaxRebate.Field1 + PODisTaxRebate.Field2)
So I need to write a query. What I have now is:
var reportModels =
Session.QueryOver<Domain.Model.Purchasing.Vendor>(() => v)
.Left.JoinQueryOver(() => v.Invoices, () => invoice)
.Left.JoinQueryOver(() => invoice.PurchaseOrder, () => poOrder)
.Left.JoinQueryOver(() => poOrder.PurchaseOrderDistributions, () => poDistribution)
.Left.JoinQueryOver(() => poDistribution.TaxRebate, () => poTaxRebate)
.SelectList(
list =>
list.Select(() => v.Number).WithAlias(() => varptModel.VendorNumber)
.Select(() => v.TypeCode.Code).WithAlias(() => varptModel.VendorType)
.Select(() => v.Name).WithAlias(() => varptModel.VendorName)
.Select(() => v.PurchasingContactPhoneNumber + "-Ext." + v.PurchasingContactPhoneNumberExt).WithAlias(() => varptModel.Phone)
.Select(() => v.Address).WithAlias(() => varptModel.Address)
.Select(() => invFiscalYear.Year).WithAlias(() => varptModel.Year)
.Select(() => invoice.TotalAmount).WithAlias(() => varptModel.InvoiceToDate)
.Select(() => invoice.AmountPaidToDate).WithAlias(() => varptModel.PaymentToDate)
.Select(() => poOrder.Estimate).WithAlias(() => varptModel.OrdersToDate)
.Select(() => poOrder.Estimate - Sum(poDistribution.Field1) - Sum(poTaxRebate.Discount1 + poTaxRebate.Discount2) )
).List();
But this is not right. What should I change it to?
I tried many things and found this working
.Select(Projections.SqlFunction(new VarArgsSQLFunction("", "+", ""),
NHibernateUtil.Double,
Projections.SqlFunction(new VarArgsSQLFunction("", "+", ""),
NHibernateUtil.Double,
Projections.Sum(Projections.SqlFunction("coalesce", NHibernateUtil.Double, Projections.Property(() => invoiceLineItem.Expense), Projections.Constant(0))),
Projections.Sum(Projections.SqlFunction("coalesce", NHibernateUtil.Double, Projections.Property(() => invitemTaxRebate.Rebate1Expense), Projections.Constant(0)))),
Projections.Sum(Projections.SqlFunction("coalesce", NHibernateUtil.Double, Projections.Property(() => invitemTaxRebate.Rebate2Expense), Projections.Constant(0)))))
.WithAlias(() => varptModel.ToDateInvoices)
which gave me this in SQL
sum(coalesce(invoicelin8_.Expense, 0 )) + sum(coalesce(invitemtax9_.Rebate1Expense, 0 )) + sum(coalesce(invitemtax9_.Rebate2Expense, 0 ))
I added Coalesce as when we add or subtract values with null value, all values becomes null in result. Just a hint for new ones.
I am working with the SoundCloud API to try and get the number of times a users tracks have been played. This will be the total amount played for all tracks combined.
I can get a returned array from the Soundcloud API which displays all the users tracks that are available.
I need to loop through all these tracks and add up all the "[playback_count]". This will give me the total figure that I need.
I just do not know how to loop through the array to get at the information and get and display the final result.
Any help would be greatly appreciated.
Here is the returned array - I have removed some aspects as there was a lot of code.
Array
(
[0] => Array
(
[kind] => track
[id] => 81677429
[created_at] => 2013/03/03 22:32:32 +0000
[user_id] => 7160186
[duration] => 365773
[commentable] => 1
[state] => finished
[original_content_size] => 15046155
[sharing] => public
[tag_list] => nari & milani martindhamen benny benassi steve angello laidback luke mightydubkatz robin s amanda wilson justanothergroove atom satisfaction showmelove loveonmymind mass 2012 2013 house progressive electro bootleg remix mashup
[permalink] => just-another-groove-one-step
[streamable] => 1
[embeddable_by] => all
[downloadable] => 1
[purchase_url] =>
[label_id] =>
[purchase_title] =>
[genre] => Progressive House
[title] => Just Another Groove, One Step Atom, Satisfaction, Show Me Love, Love On My Mind (MASS BOOTLEG)
[description] => Nari & Milani vs. Martin Dhamen, Benny Benassi, Steve Angello, Laidback Luke, Mighty Dub Katz featuring The Biz and Robin S, Amanda Wilson - Just Another Groove, One Step Atom, Satisfaction, Show Me Love, Love On My Mind (MASS BOOTLEG)
[label_name] =>
[release] =>
[track_type] =>
[key_signature] =>
[isrc] =>
[video_url] =>
[bpm] =>
[release_year] =>
[release_month] =>
[release_day] =>
[original_format] => mp3
[license] => all-rights-reserved
[uri] => http://api.soundcloud.com/tracks/81677429
[user] => Array
(
[id] => 7160186
[kind] => user
[permalink] => mass-official
[username] => mass official
[uri] => http://api.soundcloud.com/users/7160186
[permalink_url] => http://soundcloud.com/mass-official
[avatar_url] => http://i1.sndcdn.com/avatars-000029524162-jdiyn4-large.jpg?45575d7
)
[permalink_url] => http://soundcloud.com/mass-official/just-another-groove-one-step
[artwork_url] => http://i1.sndcdn.com/artworks-000042075610-suv3cx-large.jpg?45575d7
[waveform_url] => http://w1.sndcdn.com/qWZAqcPzSqdW_m.png
[stream_url] => http://api.soundcloud.com/tracks/81677429/stream
[download_url] => http://api.soundcloud.com/tracks/81677429/download
[playback_count] => 668
[download_count] => 132
[favoritings_count] => 12
[comment_count] => 7
[attachments_uri] => http://api.soundcloud.com/tracks/81677429/attachments
)
[1] => Array
(
[kind] => track
[id] => 64330580
[created_at] => 2012/10/22 06:33:05 +0000
[user_id] => 7160186
[duration] => 4704989
[commentable] => 1
[state] => finished
[original_content_size] => 188185127
[sharing] => public
[tag_list] =>
[permalink] => mass-summer-party-mix-2012-1
[streamable] => 1
[embeddable_by] => all
[downloadable] => 1
[purchase_url] =>
[label_id] =>
[purchase_title] =>
[genre] => Dance-pop, House
[title] => MASS SUMMER PARTY MIX 2012
[description] => 01-Will.I.Am feat. Eva Simons - This Is Love
[label_name] =>
[release] =>
[track_type] =>
[key_signature] =>
[isrc] =>
[video_url] =>
[bpm] =>
[release_year] =>
[release_month] =>
[release_day] =>
[original_format] => mp3
[license] => all-rights-reserved
[uri] => http://api.soundcloud.com/tracks/64330580
[user] => Array
(
[id] => 7160186
[kind] => user
[permalink] => mass-official
[username] => mass official
[uri] => http://api.soundcloud.com/users/7160186
[permalink_url] => http://soundcloud.com/mass-official
[avatar_url] => http://i1.sndcdn.com/avatars-000029524162-jdiyn4-large.jpg?45575d7
)
[permalink_url] => http://soundcloud.com/mass-official/mass-summer-party-mix-2012-1
[artwork_url] => http://i1.sndcdn.com/artworks-000032637806-efhtcw-large.jpg?45575d7
[waveform_url] => http://w1.sndcdn.com/bVg89jcTqVDF_m.png
[stream_url] => http://api.soundcloud.com/tracks/64330580/stream
[download_url] => http://api.soundcloud.com/tracks/64330580/download
[playback_count] => 5416
[download_count] => 3120
[favoritings_count] => 95
[comment_count] => 10
[attachments_uri] => http://api.soundcloud.com/tracks/64330580/attachments
)
[2] => Array
(
[kind] => track
[id] => 59035163
[created_at] => 2012/09/07 15:30:13 +0000
[user_id] => 7160186
[duration] => 426645
[commentable] => 1
[state] => finished
[original_content_size] => 17065398
[sharing] => public
[tag_list] => avicii nicky romero coldplay mass nicktim everyteardropisawaterfall 2012 mix house progressive electronic electronica bootleg mashup
[permalink] => avicii-nicky-romero-ft-1
[streamable] => 1
[embeddable_by] => all
[downloadable] => 1
[purchase_url] =>
[label_id] =>
[purchase_title] =>
[genre] => Progressive House
[title] => Avicii & Nicky Romero ft. Coldplay - Nicktim Vs. Every Teardrop Is A Waterfall (Mass Bootleg)
[description] =>
[label_name] =>
[release] =>
[track_type] =>
[key_signature] =>
[isrc] =>
[video_url] =>
[bpm] =>
[release_year] =>
[release_month] =>
[release_day] =>
[original_format] => mp3
[license] => all-rights-reserved
[uri] => http://api.soundcloud.com/tracks/59035163
[user] => Array
(
[id] => 7160186
[kind] => user
[permalink] => mass-official
[username] => mass official
[uri] => http://api.soundcloud.com/users/7160186
[permalink_url] => http://soundcloud.com/mass-official
[avatar_url] => http://i1.sndcdn.com/avatars-000029524162-jdiyn4-large.jpg?45575d7
)
[permalink_url] => http://soundcloud.com/mass-official/avicii-nicky-romero-ft-1
[artwork_url] => http://i1.sndcdn.com/artworks-000029888965-2kigan-large.jpg?45575d7
[waveform_url] => http://w1.sndcdn.com/iJ3jS6UcvgH0_m.png
[stream_url] => http://api.soundcloud.com/tracks/59035163/stream
[download_url] => http://api.soundcloud.com/tracks/59035163/download
[playback_count] => 2786
[download_count] => 728
[favoritings_count] => 38
[comment_count] => 11
[attachments_uri] => http://api.soundcloud.com/tracks/59035163/attachments
)
[3] => Array
(
[kind] => track
[id] => 56192626
[created_at] => 2012/08/13 19:58:55 +0000
[user_id] => 7160186
[duration] => 309616
[commentable] => 1
[state] => finished
[original_content_size] => 12380020
[sharing] => public
[tag_list] => rihanna miami2ibiza wherehaveyoubeen mass bootleg 2012 progressive swedish house mafia
[permalink] => swedish-house-mafia-ft
[streamable] => 1
[embeddable_by] => all
[downloadable] => 1
[purchase_url] =>
[label_id] =>
[purchase_title] =>
[genre] => Progressive House
[title] => Swedish House Mafia Ft. Rihanna - Where Have You Been, Miami 2 Ibiza (Mass Bootleg)
[description] =>
[label_name] =>
[release] =>
[track_type] =>
[key_signature] =>
[isrc] =>
[video_url] =>
[bpm] =>
[release_year] =>
[release_month] =>
[release_day] =>
[original_format] => mp3
[license] => all-rights-reserved
[uri] => http://api.soundcloud.com/tracks/56192626
[user] => Array
(
[id] => 7160186
[kind] => user
[permalink] => mass-official
[username] => mass official
[uri] => http://api.soundcloud.com/users/7160186
[permalink_url] => http://soundcloud.com/mass-official
[avatar_url] => http://i1.sndcdn.com/avatars-000029524162-jdiyn4-large.jpg?45575d7
)
[permalink_url] => http://soundcloud.com/mass-official/swedish-house-mafia-ft
[artwork_url] => http://i1.sndcdn.com/artworks-000028404589-qmmquq-large.jpg?45575d7
[waveform_url] => http://w1.sndcdn.com/5HwZSU9IA03i_m.png
[stream_url] => http://api.soundcloud.com/tracks/56192626/stream
[download_url] => http://api.soundcloud.com/tracks/56192626/download
[playback_count] => 3567
[download_count] => 891
[favoritings_count] => 66
[comment_count] => 20
[attachments_uri] => http://api.soundcloud.com/tracks/56192626/attachments
)
[4] => Array
(
[kind] => track
[id] => 55370840
[created_at] => 2012/08/06 13:43:46 +0000
[user_id] => 7160186
[duration] => 352943
[commentable] => 1
[state] => finished
[original_content_size] => 14112438
[sharing] => public
[tag_list] => mass progressive house 2012 mashup timbaland basto bootleg remix keri hilson thewayiare
[permalink] => the-way-i-are-mass-mashup
[streamable] => 1
[embeddable_by] => all
[downloadable] => 1
[purchase_url] =>
[label_id] =>
[purchase_title] =>
[genre] => Progressive House
[title] => Timbaland ft. Keri Hilson vs Kylie Minogue - Put Your Hands Up, The Way i are (Mass Mashup)
[description] => Tracks:
Kylie Minogue - Put Your Hands Up (If You Feel Love) (Basto's Major Mayhem US Instrumental)
Timberland Featuring Keri Hilson - The Way I Are
[label_name] =>
[release] =>
[track_type] =>
[key_signature] =>
[isrc] =>
[video_url] =>
[bpm] =>
[release_year] =>
[release_month] =>
[release_day] =>
[original_format] => mp3
[license] => all-rights-reserved
[uri] => http://api.soundcloud.com/tracks/55370840
[user] => Array
(
[id] => 7160186
[kind] => user
[permalink] => mass-official
[username] => mass official
[uri] => http://api.soundcloud.com/users/7160186
[permalink_url] => http://soundcloud.com/mass-official
[avatar_url] => http://i1.sndcdn.com/avatars-000029524162-jdiyn4-large.jpg?45575d7
)
[permalink_url] => http://soundcloud.com/mass-official/the-way-i-are-mass-mashup
[artwork_url] => http://i1.sndcdn.com/artworks-000027981094-tnahdz-large.jpg?45575d7
[waveform_url] => http://w1.sndcdn.com/A2SE6kUb06MP_m.png
[stream_url] => http://api.soundcloud.com/tracks/55370840/stream
[download_url] => http://api.soundcloud.com/tracks/55370840/download
[playback_count] => 2270
[download_count] => 621
[favoritings_count] => 28
[comment_count] => 17
[attachments_uri] => http://api.soundcloud.com/tracks/55370840/attachments
)
[5] => Array
(
[kind] => track
[id] => 49905943
[created_at] => 2012/06/16 19:31:15 +0000
[user_id] => 7160186
[duration] => 403588
[commentable] => 1
[state] => finished
[original_content_size] => 16137458
[sharing] => public
[tag_list] => "eric prydz" "dirty south" "those usual suspects" erikhecht "walking alone" 2night 2012 mass mashup "progressive house"
[permalink] => walking-alone-2night-mass-1
[streamable] => 1
[embeddable_by] => all
[downloadable] => 1
[purchase_url] =>
[label_id] =>
[purchase_title] =>
[genre] => Progressive House
[title] => Eric Prydz, Dirty South & Those Usual Suspects Ft. Erik Hecht - Walking Alone 2NIGHT (Mass Mashup)
[description] =>
[label_name] =>
[release] =>
[track_type] =>
[key_signature] =>
[isrc] =>
[video_url] =>
[bpm] =>
[release_year] =>
[release_month] =>
[release_day] =>
[original_format] => mp3
[license] => all-rights-reserved
[uri] => http://api.soundcloud.com/tracks/49905943
[user] => Array
(
[id] => 7160186
[kind] => user
[permalink] => mass-official
[username] => mass official
[uri] => http://api.soundcloud.com/users/7160186
[permalink_url] => http://soundcloud.com/mass-official
[avatar_url] => http://i1.sndcdn.com/avatars-000029524162-jdiyn4-large.jpg?45575d7
)
[permalink_url] => http://soundcloud.com/mass-official/walking-alone-2night-mass-1
[artwork_url] => http://i1.sndcdn.com/artworks-000025156708-j3k92q-large.jpg?45575d7
[waveform_url] => http://w1.sndcdn.com/LtSQavuMGFiI_m.png
[stream_url] => http://api.soundcloud.com/tracks/49905943/stream
[download_url] => http://api.soundcloud.com/tracks/49905943/download
[playback_count] => 4982
[download_count] => 911
[favoritings_count] => 64
[comment_count] => 53
[attachments_uri] => http://api.soundcloud.com/tracks/49905943/attachments
)
[11] => Array
(
[kind] => track
[id] => 32861896
[created_at] => 2012/01/09 14:05:01 +0000
[user_id] => 7160186
[duration] => 379886
[commentable] => 1
[state] => finished
[original_content_size] => 15189753
[sharing] => public
[tag_list] => prty a lmfao partyrock partyrockanm 2012 mass mashup rayfoxx the thetrumpeter house latin electronic
[permalink] => lmfao-ray-foxx-party-rock
[streamable] => 1
[embeddable_by] => all
[downloadable] => 1
[purchase_url] =>
[label_id] =>
[purchase_title] =>
[genre] => Mashup/Bootleg
[title] => LMFAO-Ray Foxx - Party Rock Trumpeter (Mass Mashup)
[description] =>
[label_name] =>
[release] =>
[track_type] =>
[key_signature] =>
[isrc] =>
[video_url] =>
[bpm] =>
[release_year] =>
[release_month] =>
[release_day] =>
[original_format] => mp3
[license] => all-rights-reserved
[uri] => http://api.soundcloud.com/tracks/32861896
[user] => Array
(
[id] => 7160186
[kind] => user
[permalink] => mass-official
[username] => mass official
[uri] => http://api.soundcloud.com/users/7160186
[permalink_url] => http://soundcloud.com/mass-official
[avatar_url] => http://i1.sndcdn.com/avatars-000029524162-jdiyn4-large.jpg?45575d7
)
[permalink_url] => http://soundcloud.com/mass-official/lmfao-ray-foxx-party-rock
[artwork_url] => http://i1.sndcdn.com/artworks-000017156126-hlomgx-large.jpg?45575d7
[waveform_url] => http://w1.sndcdn.com/nVXX8DZRwfBF_m.png
[stream_url] => http://api.soundcloud.com/tracks/32861896/stream
[download_url] => http://api.soundcloud.com/tracks/32861896/download
[playback_count] => 2060
[download_count] => 463
[favoritings_count] => 24
[comment_count] => 12
[attachments_uri] => http://api.soundcloud.com/tracks/32861896/attachments
)
)
This is the code I used to get the array - Using WordPress
<?php
/* Now get the tracks information */
$json = wp_remote_get("http://api.soundcloud.com/users/USERID/tracks.json?client_id=CLIENT_ID");
$soundcloudData = json_decode($json['body'], true);
print "<pre>";
print_r($soundcloudData);
print "</pre>";
?>
The Solution
I think I got it to work. I had to slightly change the code slightly.
$json = wp_remote_get("http://api.soundcloud.com/users/7160186/tracks.json?client_id={MY_CLIENT_ID}");
$soundcloudData = json_decode($json['body'], true);
$totalPlays = 0;
foreach ($soundcloudData as $track) {
$totalPlays += $track['playback_count'];
}
print_r($totalPlays);
This returned the number 117427
The following should work:
<?php
$json = wp_remote_get("http://api.soundcloud.com/users/2/tracks.json?client_id=YOUR_CLIENT_ID");
$soundcloudData = json_decode($json);
$totalPlays = 0;
foreach ($soundcloudData as $track) {
$totalPlays += $track->playback_count;
}
print_r($totalPlays);
?>