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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:06:19+00:00 2026-06-07T08:06:19+00:00

I have been using curl to get an xml response from a payment gateway

  • 0

I have been using curl to get an xml response from a payment gateway since last january and before another one using the same code since about 5 years. Last friday it stopped working and the code hasn’t been modified and both the host and the payment gateway tell me nothing has changed either.

I have done multiple tests to access the url with curl, fopen and file_get_contents to try to make it work. I seem to be able to access common sites like Google, Facebook and php.net but not the site I want and other sites i worked on.

The code I use for testing is :

$ch = curl_init();
curl_setopt($ch, CURLOPT_VERBOSE, 1); // comment once in production
if(!curl_setopt($ch, CURLOPT_URL, $url)) {echo 'CURLOPT URL Error<p>';}
if(!curl_setopt($ch, CURLOPT_HEADER, 1)) {echo 'CURLOPT Header Error<p>';}
if(!curl_setopt($ch, CURLOPT_HTTPHEADER, array('POST /AUTHORIZE HTTP/1.0', 'MIME-Version: 1.0', 'Content-type: application/PTI21',
'Content-transfer-encoding: text', 'Request-number: 1', 'Document-type: Request'))) {echo 'CURLOPT HTTPHEADER Error<p>';}
if(!curl_setopt($ch, CURLOPT_TIMEOUT, 90)) {echo 'CURLOPT TIMEOUT Error<p>';} 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // gives error, but keeps xml formatting

$result=curl_exec ($ch);
curl_close ($ch);
echo $result;
$options = array(
    'return_info'   => true,
    'method'        => 'post'
);
$result = file_get_contents($url);
print_r($result);


$fd = fopen( $url, "r" );
if( !$fd )
{
    echo "Cannot open URL";
} else {
    while ( !feof( $fd ) ) {
        $buffer = fgets( $fd, 4096 );
        echo $buffer;
    }
    fclose ( $fd );
}

I was wondering if there was anything wrong with it because on another host it works everytime and with the host it’s on, it only works for half the sites i try.

  • 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-07T08:06:20+00:00Added an answer on June 7, 2026 at 8:06 am

    It’s hard to give a valid response without knowing the actual URL.

    One problem could be that the URL is redirecting, for example when some people redirect domain.com to http://www.domain.com.

    For those scenarios you can use.

     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    

    Please run the command below to get some more information on what happened.

    print_r(curl_info($ch));
    

    Put that code right below the curl_exec

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

Sidebar

Related Questions

I have several strings that have been pulled using cURL from another website. The
I have been trying to post login credentials to an https site using cURL
I have been trying for about a day now to get an xml feed
I have been madly trying to get access token for my users since long.
i have been trying to get the source of a page in php using
I have been using Curl for making network calls and I can use the
I have been using TortoiseSVN for some time and I really like it. I
I have been using Stanford POS Tagger to tag parts of speech in a
I have been using play 1.2.5rc4 for development of one app and I have
I have been using an API to do some work. This is how I

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.