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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:12:59+00:00 2026-06-13T14:12:59+00:00

I’m quite stuck in how to edit this script be able to take a

  • 0

I’m quite stuck in how to edit this script be able to take a request from jquery and return to me the value the script returns? Any help is most gratefully appreciated?

I can use it to pass an xml file and url from the filesystem and get the return I expect but would really like to be able to use it as a proxy to a wsdl service.

[edit] Due to environmental changes I’m wanting to use the below script to pass back to me the xml return from a wsdl service that I’m passing xml. It works fine when I do so from the command line – I’m just unsure how to be able to get the script to accept a post and then return the xml return from the service call.

I’m using the script as follows from the command line:

php file.php theurl <test.xml

^^ Which returns to me the xml I would like to then pass back to the frontend

<?php
ini_set('display_errors', "1");

$url= $argv[1];

echo "url\n$url\n";

preg_match("/https?:\/\/([^\/]*)(.*)/", $url, $matches);
$host=$matches[1];
$request=$matches[2];

$mxml=fread(STDIN,65536);
$yt =curl_init();
$header =   "POST $request  HTTP/1.0\r\n";
$header .=  "Host: $host\r\n";
$header .=  "SoapAction:";
$header .=  "Content-Type: text/xml\r\n";
$header .=  "Content-Length: ".strlen($mxml)."\r\n";
$header .=  "Content-Transfer-Encoding: text\r\n";
$header .=  "Connection-Close: close\r\n\r\n";

echo "header\n$header\n";

$header .=  $mxml;

curl_setopt($yt, CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($yt, CURLOPT_URL, $url);
curl_setopt($yt, CURLOPT_CUSTOMREQUEST, $header);
curl_setopt($yt, CURLOPT_RETURNTRANSFER, true);

$rxml=curl_exec($yt);
echo "sent\n$mxml\n";
echo "received\n$rxml\n";

echo curl_error($yt);
?>
  • 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-06-13T14:13:00+00:00Added an answer on June 13, 2026 at 2:13 pm

    Sussed it. Sorry forgot to post answer. Hopefully help someone else:

    <?php
    $url = 'http://myURL';
    $xmlpost = file_get_contents('php://input');
    
    $header =   "POST $url  HTTP/1.0\r\n";
    $header .=  "Host: myHOST\r\n";
    $header .=  "SoapAction: ''";
    
    $ch = curl_init();
    
    //Set the URL
    curl_setopt($ch, CURLOPT_URL, $url);
    //Enable POST data
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlpost);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);
    
    //curl_exec automatically writes the data returned
    $response = curl_exec($ch);
    curl_close($ch);
    echo $response;
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I have a view passing on information from a database: def serve_article(request, id): served_article
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.