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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:10:01+00:00 2026-05-30T18:10:01+00:00

I am trying to write an API for a mobile application. I would like

  • 0

I am trying to write an API for a mobile application. I would like to return the data in XML. I am using the PHP library built for Wolfram Alpha to query their data, and want my API to act as a go between for the mobile application and Wolfram Alpha. Whenever I try to print an XML document after using the Wolfram Alpha PHP library, I get an error from Chrome stating:

error on line 7 at column 6: XML declaration allowed only at the start of the document

I get nothing in IE, and in Firefox I get:

XML Parsing Error: XML or text declaration not at start of entity
Location: http://myfitnessplate.com/api/food-search/name/thisissomethingnotfood/key/HWGCF-YASLT-HOSEC-OZWJH-HETKJ
Line Number 7, Column 1:
<?xml version="1.0"?>
^

With no other data. I opened up the main file for the Wolfram Alpha PHP library (WolframAlphaEngine.php) and noticed that it is using SimpleXML to query Wolfram Alpha in the following code

$xml = simplexml_load_file( $url );

I get the XML error whenever I use the library. If I don’t use the library, the XML outputs just fine. Is it possible that the “simplexml_load_file” is causing my XML to break for some reason?

My code that doesn’t work when using the library that uses simplexml_load_file (this does work when not using the library):

$xml = new SimpleXMLElement('<xml/>');
header("Content-Type:text/xml");
echo $xml->asXML();
  • 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-30T18:10:03+00:00Added an answer on May 30, 2026 at 6:10 pm

    I strongly suspect that there are seven lines of output somewhere before you echo out your XML. You need to silence this output, because it is causing your xml to become invalid, which is causing your browsers to go crazy.

    Possibly it is error messages from your included library. Possibly there is leading or trailing whitespace in your php files. The only way to know is to see the raw output before the browser starts parsing it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a javascript application that loads data from the openstreetmap API
So right now I've developed an application that I'm trying to write an API
I'm trying to write a drop-in replacement for System.Media.SoundPlayer using the waveOut... API. This
I'm trying to write a full screen application for Windows CE 5.0. I'm using
I'm trying to write a simple maze game, without using any deprecated OpenGL API
I'm trying to write xml data with XmlLite on buffer but couldn't got any
I'm trying to write a voip app for Android, using the Android SIP API
I'm trying to write an API for a website, whose Flash app gets data
I'm trying to write a REST-API server with NodeJS like the one used by
Trying to write a simple call to google's JSON stock ticker API. I would

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.