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 7624211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:54:13+00:00 2026-05-31T04:54:13+00:00

I have a Codeigniter controller which takes a full URL as the first argument,

  • 0

I have a Codeigniter controller which takes a full URL as the first argument, but the passed URL inside my controller only is only showing http:

public function mydata($link)
{
   echo $link; //then it show only http: rather than the full url http://abc.com
}

How can i solve this issue?

  • 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-05-31T04:54:15+00:00Added an answer on May 31, 2026 at 4:54 am

    In Codeigniter controllers, each method argument comes from the URL separated by a / slash. http://example.com

    There are a few different ways to piece together the the arguments into one string:

    public function mydata($link)
    {
        // URL: http://example.com/mysite/mydata/many/unknown/arguments
    
        // Ways to get the string "many/unknown/arguments"
        echo implode('/', func_get_args());
        echo ltrim($this->uri->uri_string(), '/');
    }
    

    However:

    In your case, the double slash // may be lost using either of those methods because it will be condensed to one in the URL. In fact, I’m surprised that a URL like:

    http://example.com/mydata/http://abc.com

    …didn’t trigger Codeigniter’s “The URI contains disallowed chatacters” error. I’d suggest you use query strings for this task to avoid all these problems:

    http://example.com/mydata/?url=http://abc.com

    public function mydata()
    {
        $link = $this->input->get('url');
        echo $link;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using CodeIgniter and I have a controller which processes uploads using AJAX. The
I have a CodeIgniter app which has a controller to invoke Capistrano. Like so:
I am trying to code my first codeigniter project. I have a login controller
I have some CodeIgniter controllers which should only be accessed by users who have
I have 2 functions/methods in the same controller in CodeIgniter like this: public function
I have this function on my controller (Im using CodeIgniter) that reads the database,
I am using Codeigniter message library. In my controller I have the following code
I have a codeigniter code that is working on local Apache installation. But it
I have a CodeIgniter project, and I want to invoke one of my controller
I am trying to create a URL shortener using CodeIgniter 2. I have 2

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.