Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8741743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:22:14+00:00 2026-06-13T11:22:14+00:00

I am not getting the correct output from the server. The response I get

  • 0

I am not getting the correct output from the server. The response I get back everytime is:

Gone

/prod/bwckgens.p_proc_term_datehas been permanently removed from this server.

This is usually recieved when you just direct the web browser to the page here instead of going through this page first. This makes me come to the conclusion that a cookie isn’t being saved, but I read in the documentation that this is all handled by the NSURLConnection object. Is there something I am doing wrong here?

#import "PCFViewController.h"

@interface PCFViewController ()

@end

NSMutableData *mutData;

@implementation PCFViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)queryServer {
    NSURL *url = [NSURL URLWithString:@"https://selfservice.mypurdue.purdue.edu/prod/bwckschd.p_disp_dyn_sched"];
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLCacheStorageAllowed timeoutInterval:3.0];
    //the reason I perform a GET here is just to get a cookie and communicate like a normal web browser, since directly doing a POST to the proper address isn't working
    [request setHTTPMethod:@"GET"];
    [request setValue:@"text/html; charset=UTF-8" forHTTPHeaderField:@"Content-Type"];
    NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
    if (connection) {
        mutData = [NSMutableData data];
    }
}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
    NSLog(@"Succeeded! Received %d bytes of data",[mutData length]);
    NSString *str = [[NSString alloc] initWithData:mutData encoding:NSUTF8StringEncoding];
    //just to see the contents(for debugging)
    NSLog(@"%@", str);

    [self handleConnection:connection];
}

-(void)handleConnection:(NSURLConnection *)connection
{
    //this is the first step
    if ([@"/prod/bwckschd.p_disp_dyn_sched" isEqualToString:[[[connection originalRequest] URL] path]]) {
        //first request
        //POST
        NSURL *url = [NSURL URLWithString:@"https://selfservice.mypurdue.purdue.edu/prod/bwckgens.p_proc_term_date"];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLCacheStorageAllowed timeoutInterval:3.0];
        [request setHTTPMethod:@"POST"];
        NSString *args = @"p_calling_proc=bwckschd.p_disp_dyn_sched&p_term=201320";
        NSData *requestBody = [args dataUsingEncoding:NSUTF8StringEncoding];
        [request setHTTPBody:requestBody];
        connection = [connection initWithRequest:request delegate:self];
        [connection start];
        if (connection) {
            mutData = [NSMutableData data];
        }
        //second step. Here I send the list of classes(COMPUTER SCIENCE) I want to display as well as the term SPRING2013
    }else if([@"/prod/bwckgens.p_proc_term_date" isEqualToString:[[[connection currentRequest] URL] path]]) {
        NSURL *url = [NSURL URLWithString:@"https://selfservice.mypurdue.purdue.edu/prod/bwckschd.p_get_crse_unsec"];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLCacheStorageAllowed
                                                           timeoutInterval:3.0];
        [request setHTTPMethod:@"POST"];
        NSString *args = @"term_in=201320&sel_subj=dummy&sel_day=dummy&sel_schd=dummy&sel_insm=dummy&sel_camp=dummy&sel_levl=dummy&sel_sess=dummy&sel_instr=dummy&sel_ptrm=dummy&sel_attr=dummy&sel_subj=CS&sel_crse=dummy&sel_title=dummy&sel_schd=%25&sel_from_cred=&sel_to_cred=&sel_camp=%25&sel_ptrm=%25&sel_instr=%25&sel_sess=%25&sel_attr=%25&begin_hh=0&begin_mi=0&begin_ap=a&end_hh=0&end_mi=0&end_ap=a";
        NSData *requestBody = [args dataUsingEncoding:NSUTF8StringEncoding];
        [request setHTTPBody:requestBody];
        connection = [connection initWithRequest:request delegate:self];
        [connection start];
        if (connection) {
            mutData = [NSMutableData data];
        }
        //the courses should be shown now I have to parse the data
    }else if([@"/prod/bwckschd.p_get_crse_unsec" isEqualToString:[[[connection currentRequest] URL] path]]) {


    }
}
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
    NSLog(@"%@\n", error.description);
}

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
    [mutData setLength:0];
    NSLog(@"%@\n", response.description);

}

-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
    [mutData appendData:data];
}
@end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:22:14+00:00Added an answer on June 13, 2026 at 11:22 am

    You cannot change the Request Object with the same URL Connection once it is started. Read the documentation of NSURLConnection. it says:

    The URL request to load. The request object is deep-copied as part of
    the initialization process. Changes made to request after this method
    returns do not affect the request that is used for the loading
    process.

    So if you want to hit another URL, you have to create a new URLRequest and new URLConnection object. regarding your question about saving cookies. you can set the cache policy of the URLRequest using the following method

    - (void)setCachePolicy:(NSURLRequestCachePolicy)policy
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting DataTables warning: JSON data from server could not be parsed. This
I am not getting the correct output. data.m --------- @implementation data - (id) initWithID:(int)
I'm using .NET 4 and getting Input string not in correct format error when
I am getting an exception error, Input string was not in a correct format.
I'm getting UnsatisfiedLinkError when invoking C functions from JNI though my setup seems correct.
I keep getting back a value of undefined... Not sure why it's not working
my mysqli_fetch_array(mysqi_query($db, $query)) doesn't appear to be getting the correct information from the database,
Really simple but just not getting it. I want to reference a view by
I'm not getting any anti-aliasing when using drawing GL_TRIANGLE_FANs with this code: glDisable(GL_DEPTH_TEST); //
I am not getting that how to differentiate same element name for eg City,Area

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.