PHP Get Content of HTTP 400 Response

后端 未结 2 1334
名媛妹妹
名媛妹妹 2020-12-01 16:50

I am using PHP with the Amazon Payments web service. I\'m having problems with some of my requests. Amazon is returning an error as it should, however the way it goes about

相关标签:
2条回答
  • 2020-12-01 17:25

    As a follow-up to DoubleThink's post, here is a working example:

    $url = 'http://whatever.com';
    
    //Set stream options
    $opts = array(
      'http' => array('ignore_errors' => true)
    );
    
    //Create the stream context
    $context = stream_context_create($opts);
    
    //Open the file using the defined context
    $file = file_get_contents($url, false, $context);
    
    0 讨论(0)
  • 2020-12-01 17:28

    You have to define custom stream context (3rd argument of function file_get_contents) with ignore_errors option on.

    0 讨论(0)
提交回复
热议问题