XML error: syntax error at line 1

PHP Melody sites running versions older than v2.3.1 might give the following error while working/importing YouTube videos:

XML error: syntax error at line 1

In case your site is running a PHP Melody version earlier than v2.3.1, you will have to update it to the latest release because the YouTube API used before PHP Melody v2.3.1 is now deprecated (no longer working). Such sites cannot be fixed as the entire API code was replaced throughout the codep/product.

Check our update guide to update your PHP Melody site today.

How to create a YouTube API key

As is tradition, the process consists of 3 easy steps:

  1. Creating a new project in your Google Cloud Platform account.
  2. Enabling the “YouTube Data API V3″ data source for your newly created project. 
  3. Generating the API key to access the YouTube API.

Step 1

Log into your Google Cloud Platform account. Create your new project or select an existing one. 


Step 2

Once your new project is available, search “YouTube Data API V3” and enable the data source. You can also create the project here if you’re a rebel and skipped step 1. 

The end goal is to enable the YouTube data source for your project, which you did. Half-way there.


Step 3

Generate and save your API keys as illustrated below. But first, locate the YouTube DATA API.


Here you can choose to restrict the API key to your own domain. If unsure about this, leave the default options until you get the website operational. Otherwise, make sure to use the correct details about your domain and the rules you set. This part can’t be ignored and is the #1 source for problems. 

When set incorrectly, there can be no communication between your domain and the YouTube API since the restrictions/rules prevent it. Don’t worry, you’ll get an error message about it. 



Job done 🥳

Just copy/pasta your shiny new API key in PHP Melody’s ‘Settings’ page (you know where) and you’re good to go.

Have fun and be mindful of API usage and Google’s terms of service.