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

  • SEARCH
  • Home
  • 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 8362139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:52:23+00:00 2026-06-09T11:52:23+00:00

I have a little tool written in JavaScript and PHP that takes a list

  • 0

I have a little tool written in JavaScript and PHP that takes a list of URLs and checks HTTP status codes for all of them.
I use curl to check the actual status.
It works great as long as I have nice URLs. I’m having a problem with a URL that has ® in it. My tool returns 404 when I know it should return 301.

My guess is that this ‘®’ is being converted to something like %C2 and causes a problem.

I know it can be done because pasting this same URL here returns 301 as it should.

My PHP curl looks like this:

        ...
        if (($curl = curl_init()) == false) {
            throw new Exception('curl_init error for url '.$_POST['url'].'.');
        }
        $header[] = "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
        $header[] = "Cache-Control: max-age=0";
        $header[] = "Connection: keep-alive";
        $header[] = "Keep-Alive: 300";
        $header[] = "Accept-Charset: iso-8859-1,utf-8;q=0.7,*;q=0.7";
        $header[] = "Accept-Language: en-US;q=0.5";
        $header[] = "Pragma: ";
        
        curl_setopt($curl, CURLOPT_URL, $_POST['url']);
        curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
        curl_setopt($curl, CURLOPT_NOBODY, true);
        curl_setopt($curl, CURLOPT_AUTOREFERER, true);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_TIMEOUT, 50);
        $Cresponse = curl_exec($curl); // execute the curl command
        $response['callback']['data'] = $http_status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
        curl_close($curl);
        ...

I tried to use urldecode() but this encodes the whole URL along with http:// to http%3A%2F%2F.

Any idea why this ® is causing problems?

  • 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-09T11:52:25+00:00Added an answer on June 9, 2026 at 11:52 am

    Use parse_url() and urlencode() just the path, query and fragment.

    Then reassemble the encoded URL and make the request.

    $url = parse_url ($_POST['url']);
    if ($url === FALSE) {
        /* error handling */
    }
    $encoded_url = $url['scheme'] . "://" .
                   $url['host']   .
                   urlencode ($url['path])     . "?"   .
                   urlencode ($url['query])    . "#"   .
                   urlencode ($url['fragment])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a little foundation tool test (Objective-C) that I am playing with and
I have a little command line tool that reads from stdin. On the command
I have written a little Excel VBA report tool for my iPhone App sales.
I have a little tool on a web page that can be clicked and
brief history. I have a little reporting tool that I am creating that uses
I'm writing a little JavaScript tool for myself that I plan on making available
I have been thinking of maybe writing a little tool that logs into SO
I have a little problem. I have a tool that will likly have a
I have a little web admin tool I'm working on that allows a user
I have my little designer tool (my program). On the left side I have

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.