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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:42:52+00:00 2026-05-23T22:42:52+00:00

When I load the URL used below in curl function directly in a browser,

  • 0

When I load the URL used below in curl function directly in a browser, I get correct data in XML format.

But when I call it through curl, sometimes I get data in JSON format or sometimes no dat at all.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://api.ean.com/ean-services/rs/hotel/v3/list?minorRev=4&cid=55505&apiKey=5q4gzx43g6ukcrq798z2hz75&customerSessionId=&locale=en_US&currencyCode=USD&xml=<HotelListRequest><city>new%20delhi</city><RoomGroup><Room><numberOfAdults>2</numberOfAdults><numberOfResults></numberOfResults></Room></RoomGroup></HotelListRequest>");
curl_setopt($ch, CURLOPT_FAILONERROR,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

curl_setopt($ch, CURLOPT_TIMEOUT, 15);
$retValue = curl_exec($ch);                     
curl_close($ch);

echo $retValue;

The above API is working so you can test it yourself.

  • 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-23T22:42:53+00:00Added an answer on May 23, 2026 at 10:42 pm

    You need to specify XML content type explicitly in your HTTP request by setting Accept header field, so REST server knows what do you want e.g.:

    Accept: text/xml,application/xml;q=1
    

    In your case (q=1 is default value):

    curl_setopt($ch,CURLOPT_HTTPHEADER,array('Accept: text/xml,application/xml'));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I load the nextimg URL manually in the browser, it gives a new
In rhino, I'm used to being able to load javascript libraries from a URL,
<servlet> <servlet-name>myservlet</servlet-name> <servlet-class>workflow.WDispatcher</servlet-class> <load-on-startup>2</load-on-startup> </servlet> <servlet-mapping> <servlet-name>myservlet</servlet-name> <url-pattern>*NEXTEVENT*</url-pattern> </servlet-mapping> Above is the snippet from
I load data into my grid using a WCF service. When a user clicks
I used below code in ASp.NET web forms code behined. Its passing parameter in
I'm trying to integrate a third-party API (used for interacting with the OpenSecrets.org data)
The below code is used mWebView = (WebView) findViewById(R.id.webview); mWebView.getSettings().setAllowFileAccess(true); mWebView.getSettings().setJavaScriptEnabled(true); String base =
What I am trying to do is load a URL in a webView in
I have a specific class in my project that used for load and hold
I load a single instance of a window on php-gtk, I have a button

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.