PHP Get Content of HTTP 400 Response

后端 未结 2 1348
名媛妹妹
名媛妹妹 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);
    

提交回复
热议问题