Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm trying to use jsoup to log into fiverr and pull in the orders for an android app. Here's my code. I'm getting a 403 forbidden from fiverr. Assuming I'm missing something. Any ideas.

  Connection.Response res;
    try {
        res = Jsoup.connect("http://fiverr.com/login")
                .header("User-Agent", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2")
                .userAgent("Mozilla")  
                .data("user_session[username]", "myusername")
                .data("user_session[password]", "mypassword")
                .data("user_session[remember_me]", "1") 
                .method(Method.POST)
                .execute();

        Document doc = res.parse();
        String __utma = res.cookie("__utma");
        String __utmb = res.cookie("__utmb");
        String __utmc = res.cookie("__utmc");
        String __utmz = res.cookie("__utmz");
        String _fiverr_sessions = res.cookie("_fiverr_sessions");
        String _jsuid = res.cookie("_jsuid");
        String fiverr_auth_info = res.cookie("fiverr_auth_info");
        String km_ai = res.cookie("km_ai");
        String km_lv = res.cookie("km_lv");
        String km_ni = res.cookie("km_ni");
        String km_uq = res.cookie("km_uq");
        String km_vs = res.cookie("km_vs");
        String kvcd = res.cookie("kvcd");





        Document doc2 = Jsoup.connect("http://fiverr.com/users/myusername/manage_orders/type/priority")
                .header("User-Agent", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2")
                .userAgent("Mozilla")  
                .cookie("__utma", __utma)
                .cookie("__utmb", __utmb)
                .cookie("__utmc", __utmc)
                .cookie("__utmz", __utmz)
                .cookie("_fiverr_sessions", _fiverr_sessions)
                .cookie("_jsuid", _jsuid)
                .cookie("fiverr_auth_info", fiverr_auth_info)
                .cookie("km_ai", km_ai)
                .cookie("km_lv", km_lv)
                .cookie("km_ni", km_ni)
                .cookie("km_uq", km_uq)
                .cookie("km_vs", km_vs)
                .cookie("kvcd", kvcd)
                .get();

        TextView TextLocation = (TextView)findViewById(R.id.textView1);
        TextLocation.setVisibility(View.VISIBLE);
        TextLocation.setText((CharSequence) doc2.html());
        System.out.println(doc2.html());


    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

Here's the errors:

  04-18 20:25:54.444: W/System.err(552): java.io.IOException: 403 error loading URL http://fiverr.com/login
  04-18 20:25:54.464: W/System.err(552):    at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:414)
  04-18 20:25:54.475: W/System.err(552):    at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:391)
  04-18 20:25:54.535: W/System.err(552):    at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:157)
  04-18 20:25:54.565: W/System.err(552):    at com.newrock.my5._MainActivity.onCreate(_MainActivity.java:35)
  04-18 20:25:54.575: W/System.err(552):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  04-18 20:25:54.595: W/System.err(552):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
  04-18 20:25:54.595: W/System.err(552):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
  04-18 20:25:54.635: W/System.err(552):    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
  04-18 20:25:54.684: W/System.err(552):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
  04-18 20:25:54.684: W/System.err(552):    at android.os.Handler.dispatchMessage(Handler.java:99)
  04-18 20:25:54.715: W/System.err(552):    at android.os.Looper.loop(Looper.java:130)
  04-18 20:25:54.755: W/System.err(552):    at android.app.ActivityThread.main(ActivityThread.java:3683)
  04-18 20:25:54.755: W/System.err(552):    at java.lang.reflect.Method.invokeNative(Native Method)
  04-18 20:25:54.764: W/System.err(552):    at java.lang.reflect.Method.invoke(Method.java:507)
  04-18 20:25:54.794: W/System.err(552):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
  04-18 20:25:54.824: W/System.err(552):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
  04-18 20:25:54.844: W/System.err(552):    at dalvik.system.NativeStart.main(Native Method)
  04-18 20:25:55.364: I/ActivityManager(68): Displayed com.newrock.my5/._MainActivity: +6s716ms
  04-18 20:26:05.184: D/dalvikvm(142): GC_EXPLICIT freed 53K, 47% free 3123K/5831K, external 2183K/2603K, paused 86ms
  04-18 20:26:10.315: D/dalvikvm(243): GC_EXPLICIT freed 6K, 51% free 2725K/5511K, external 716K/1038K, paused 148ms
  04-18 20:26:15.285: D/dalvikvm(282): GC_EXPLICIT freed 8K, 44% free 3366K/5959K, external 716K/1038K, paused 101ms
  04-18 20:26:20.345: D/dalvikvm(311): GC_EXPLICIT freed 10K, 52% free 2776K/5703K, external 716K/1038K, paused 126ms
  04-18 20:26:25.444: D/dalvikvm(345): GC_EXPLICIT freed 7K, 44% free 3533K/6279K, external 716K/1038K, paused 134ms
  04-18 20:26:30.434: D/dalvikvm(356): GC_EXPLICIT freed 3K, 51% free 2718K/5511K, external 716K/1038K, paused 81ms
  04-18 20:29:37.864: D/SntpClient(68): request time failed: java.net.SocketException: Address family not supported by protocol
  04-18 20:29:46.895: D/dalvikvm(122): GC_CONCURRENT freed 439K, 49% free 3096K/6023K, external 716K/1038K, paused 10ms+5ms
  04-18 20:34:37.887: D/SntpClient(68): request time failed: java.net.SocketException: Address family not supported by protocol
  04-18 20:37:42.078: I/dalvikvm(128): Jit: resizing JitTable from 512 to 1024
  04-18 20:39:37.905: D/SntpClient(68): request time failed: java.net.SocketException: Address family not supported by protocol
  04-18 20:44:37.921: D/SntpClient(68): request time failed: java.net.SocketException: Address family not supported by protocol
share|improve this question
add comment

2 Answers

The 403 error indicates that you don't have the permissions needed to acces the specified URL.

Are you sure you're handling the authentication properly?

share|improve this answer
    
I'm not sure of anything. lol. I'm still learning. Any ideas what part of my script might be causing it? –  Shannon Cole Apr 18 '12 at 23:07
add comment

This is a authentication issue. Make sure you implement all authentication specific to fiverr API while trying to do any operation to the account. Even If there is a problem with oAuth you may get this code 403...

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.