Bobcares

cURL error 3 url malformed : How we fix it

by | Mar 31, 2020

Stuck with cURL error 3 URL malformed message on your website? We can help you.

The error usually occurs due to incorrect URL usage or version mismatch between cURL and the underlying application.

At Bobcares, we often get requests to fix cURL errors, as a part of our Server Management Services.

Today, let’s see how our Support Engineers fixed the cURL error 3: <url> malformed for our customers.

What is cURL error 3 URL malformed?

As we know, cURL is a tool used to transfer data between servers using network protocols. However improper usage of cURL in applications often throws errors.

Users often approach us with cURL error 3 URL malformed. As the name specifies, the error shows up when the URL is improperly formatted. This can be either due to incorrect syntax or else due to a version mismatch between cURL and the application involved.

For instance, the error appears as

cURL error 3 url malformed.

Common Causes of “URL Malformed” Error

  • The URL must start with a valid protocol such as http://, https://, ftp://, etc. Not following the protocol or using an unsupported protocol can cause this error.
  • URLs should not contain spaces or other invalid characters. Special characters should be properly URL-encoded.
  • The URL may be missing essential parts, like the domain name or path.
  • Furthermore, simple typos in the URL can cause the error.

Next, we’ll go through a few cases where our Support Engineers fixed this error.

How do we fix the cURL error?

This cURL error occurs in different servers due to different reasons. So when customers approach, our Support Engineers will have a closer look at each case and fix it. Let’s see a few such cases here.

1. Error while using a Guzzle library

One of our customers was working with the guzzle library to make HTTP requests to an API. But it ended up in cURL error 3. So, we checked the code he used to make the HTTP request.

We saw a code to verify the HTTPS URL.

$client->get('/', ['verify' => true]);

Hence, we checked the API and client settings. And ensured that the secure URL works fine. This verification is an important security check. So we never recommend skipping this, instead, we specified the location of CA files in the server in the client settings.

We also found a mismatch between URL and URI. An identifier was specified for the parameter base_url instead of a locator. Hence it ended up in cURL error.

Hence, correcting the client setting fixed the error.

In general, when such problems arise we make sure that the URL is properly specified so that we can avoid errors.

2. Paystack Laravel package

Another customer had a package that integrated the Paystack payment gateway with the Laravel app. He was getting cURL error 3 URL malformed in the Laravel app.

Our Support Engineers checked the installation location of the package. In a Laravel project, we must install the dependencies or other packages inside the root project folder.

So we installed the package in the Laravel project folder and manually published the configuration file. Later, we checked whether the config folder had the paystack.php file in it. Only then the Laravel app can use the payment gateway without error.

After that, we cleared both the config cache and app cache in Laravel.

php artisan config:cache
php artisan cache:clear

Hence it fixed the error.

3. Outdated WordPress

In this case, the customer had a WordPress site with a Wordfence plugin. But while running a malware scan, it ended with the error cURL error 3: <url> malformed.

When we checked, we found that the user had an outdated WordPress. The cURL process was not able to read the WordPress URL. The URL used ‘//’ which a new cURL version doesn’t support.

Hence we upgraded the WordPress and fixed the error.

Additional tips

  • Carefully examine the URL we are using. Make sure it includes all the necessary components like protocol, domain name, and path, and that they are spelled correctly.
  • If the URL contains special characters or spaces, make sure they are properly URL encoded. We can use online tools or libraries in your programming language to handle URL encoding.
  • Pay attention to the syntax of the URL. Forward slashes (/) are used as separators, and there shouldn’t be any typos or extra characters.

[Still, having trouble with cURL error 3 URL malformed? – We’ll fix it for you.]

Conclusion

In short, cURL error 3 URL malformed occurs due to incorrect usage of URL or due to version mismatch between cURL and the underlying web application. Today, we also saw how our Support Engineers fixed this error.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

2 Comments

    • Syam S

      Ok, please contact our support team via live chat

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.