我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

无法打开流:HTTP请求失败! 找不到HTTP / 1.1 404

I am calling rest api using file_get_contents with basic authentication. This request is working fine in Postman, but it is responding 404 with file_get_contents.

$options = array(
    'http' => array(
        'method'  => 'POST',
        'content' => json_encode($data),
        'header'  => "Content-Type: application/json
Authorization: Basic " . base64_encode('username:password') . "
",
    ),
);

$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);

近期文章

  • 如何修复手工渲染表格
  • 输入时间戳和UTC
  • ItemPoinnts SUM
  • 使用php在mysql中进行行编号
  • 我已经定义了包含文件的路径,但使用定义路径包含它们不起作用
  • Firebase通知请求各种
  • php ssh连接phpseclib
  • 使用guzzle客户端获取元标记
  • 如何以异步方式运行此PHP进程
  • 如何通过http从android发送图像
  • 如何修复此Firebase数据检索?
  • Laravel / PHP:如何解决ICS文件中的1h差异
  • phppgAdmin有多个错误 - 加载servers.php时也出错
  • 找不到类'PhpOffice \ PhpWord \ TemplateProcessor'
  • 如何输入一个数据,其他数据自动完成?
  • PHP代码正在运行,但不显示谁是发件人。 只需显示noreply@example.com
  • 我正在尝试在我的数据库中向表中插入值,但是出现了问题,插入查询不起作用[重复]
  • 迁移表单插入以使用pdo
  • mysqli_real_escape_string函数[重复]
  • 不允许使用Laravel删除方法

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华