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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:59:35+00:00 2026-05-12T13:59:35+00:00

I have a page that is making an XML POST-Request to an URL on

  • 0

I have a page that is making an XML POST-Request to an URL on a different server (e.g. “http://wwww.externalserver.com/login“). This server is sending plain HTML as response. The problem is, that the URL shown in the browser ist still on my local server, let’s say “http://localhost/callExternal.php“. The external URL is redirecting (302) to another page.

The returned HTML of this target page contains relative image paths. Because of the not matching URL these relative paths are not valid and therefore no images or stylesheets are loaded.

Is there a way to make CURL (or any other solution working in PHP4) changing the location so that these relative paths work (without parsing the HTML and changing the paths)?

This is the calling script “http://localhost/callExternal.php“:

$data = '<?xml version="1.0" encoding="UTF-8"?><Some XML></Some XML>';  

$res = curl_init('http://wwww.externalserver.com/login');

curl_setopt($res, CURLOPT_POST, 1);
curl_setopt($res, CURLOPT_HEADER, 0);
curl_setopt($res, CURLOPT_POSTFIELDS, $data);
curl_setopt($res, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($res, CURLOPT_HTTPHEADER, array("Content-Type: text/xml; charset=UTF-8"));
curl_exec($res);
curl_close($res);

And this is a snippet of the returned HTML with a link example:

<html>
<head>
<link rel="stylesheet" type="text/css" media="print" href="/css/screen.css" />
</head>
<body>test</body>
</html>

And the URL is still showing “http://localhost/callExternal.php“, so the link to the Stylesheet obviously doesn’t work.

  • 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-12T13:59:36+00:00Added an answer on May 12, 2026 at 1:59 pm

    You might want to try inserting the <base> tag inside the <head> section of the HTML ; quoting w3schools :

    The <base> tag specifies a default
    address or a default target for all
    links on a page.

    The <base> tag goes inside the head
    element.

    And, in the HTML 4 specifications :

    In HTML, links and references to
    external images, applets,
    form-processing programs, style
    sheets, etc. are always specified by a
    URI. Relative URIs are resolved
    according to a base URI, which may
    come from a variety of sources. The
    BASE element allows authors to specify
    a document’s base URI explicitly.

    When present, the BASE element must
    appear in the HEAD section of an HTML
    document, before any element that
    refers to an external source. The path
    information specified by the BASE
    element only affects URIs in the
    document where the element appears.

    The example given looks like this :

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <HTML>
     <HEAD>
       <TITLE>Our Products</TITLE>
       <BASE href="http://www.aviary.com/products/intro.html">
     </HEAD>
    
     <BODY>
       <P>Have you seen our <A href="../cages/birds.gif">Bird Cages</A>?
     </BODY>
    </HTML>
    

    And the relative URI “../cages/birds.gif” would resolve to:

    http://www.aviary.com/cages/birds.gif
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that is generated which inserts an HTML comment near the
I have a page that uses $(id).show(highlight, {}, 2000); to highlight an element when
I have a page that has an iframe From one of the pages within
I have a page that is hitting a webservice every 5 seconds to update
I have a page that is supposed to launch the Print Preview page onload.
I have a Page that has a single instance of a UserControl that itself
I have a page that contains a user control that is just a personalized
We have a page that ordinarily has two elements arranged side-by-side. Despite exploring a
I have a page that renders slowly. The trip across the net is quick.
I have a page that is using a non-standard font and arial as a

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.