derek5. 2012-09-07 17:08 采纳率: 100%
浏览 28

Soundcloud PHP curl程序

I have some php and javascript experience and just started learning curl. Been messing around with remote logins to soundcloud. Eventually I want be able to follow or unfollow through my program. I've been looking at the soundcloud source code and can't seem to figure out how it's processing the follow button clicks. The onclick is just set to return false.

  1. Can anyone guide me to how they process follows? I was thinking Ajax but the script appears to be something different. Is this json?
  2. Is there another specific language I need to know to effectively create this program?

Let me know what source code I can provide as the whole page seems too much to post.

  • 写回答

1条回答 默认 最新

  • weixin_33716941 2012-09-07 17:29
    关注

    It appears that they have a developer API that you have access to that supports following and liking users so the best way to do what you want would be to use their API for logging in and performing actions.

    If they didn't have an API, you could sniff out the requests your browser makes when you click follow and see what HTTP requests the browser makes and emulate those with cURL to get the same result. But since they have an API that is the most reliable method.

    Using the PHP API code following a user is as simple as:

    <?php
    require_once 'Services/Soundcloud.php';
    
    // create a client object with access token
    $client = new Services_Soundcloud('YOUR_CLIENT_ID', 'YOUR_CLIENT_SECRET');
    $client->setAccessToken('YOUR_ACCESS_TOKEN');
    
    // Follow user with ID 3207
    $client->put('/me/followings/3207');
    
    // check the status of the relationship
    try {
        $client->get('/me/followings/3207');
    } catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
        if ($e->getHttpCode() == '404')
            print "You are not following user 3207
    ";
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 MATLAB动图的问题
  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名