草庐IT

PHP Guzzle 客户端错误响应/错误请求 400 Google OAuth2 token

Guzzle请求try{$url='https://www.googleapis.com/oauth2/v1/tokeninfo?';$client=newClient();$request=$client->createRequest('GET',$url);$query=$request->getQuery();$query['access_token']=$access_token;$response=$client->send($request);$json=$response->json();if(!empty($json)&&!isset($json['error'])){

PHP fsockopen 400 错误请求

我有一个奇怪的问题,我收到400Badrequest作为响应,我完全不知道header有什么问题。这是我的代码:知道我做错了什么吗?谢谢编辑:感谢MrCode解决了这个问题。问题在这里:fputs($sock,join('\r\n',$header));我必须将其更改为:fputs($sock,join("\r\n",$header)."\r\n\r\n");注意双引号和“\r\n\r\n”再次感谢MrCode 最佳答案 您缺少在最终header之后需要的\r\n\r\n。目前,在最终header之后您什么都没有。将其附加到连接结果

php - Stripe 400 错误 "Invalid Positive Integer"

我有一个真正的问题。我正在尝试为一个通过Stripe向人们收费的非营利组织建立一个捐赠页面。我尝试进行的每一次收费都会给我一个错误,内容如下:已解析的请求帖子正文{"card":"TOKENWASHERE","description":"Donationby()","amount":"0","currency":"usd"}响应正文:{"error":{"type":"invalid_request_error","message":"Invalidpositiveinteger","param":"amount"}}我认为我传递给Stripe的金额有问题(显然Stripe认为它收到的

php - 为什么 get_headers() 返回 400 Bad request,而 CLI curl 返回 200 OK?

这是网址:https://www.grammarly.com我正在尝试使用nativeget_headers()获取HTTPheader功能:$headers=get_headers('https://www.grammarly.com')结果是HTTP/1.1400BadRequestDate:Fri,27Apr201812:32:34GMTContent-Type:text/plain;charset=UTF-8Content-Length:52Connection:close但是,如果我用curl命令行工具做同样的事情,结果会不同:curl-sIhttps://www.gramm

php - 尝试登录时 Yii2 中的错误请求 (#400)

我在尝试登录系统时收到BadRequest(#400)错误。我在本地主机上工作。主要布局:language?>">charset;?>">title);?>head();?>查看(login.php):title='Login';$this->params['breadcrumbs'][]=$this->title;?>OpenXcellPvt.Ltd.SignintogetintouchLogin站点Controller:['class'=>AccessControl::className(),'rules'=>[['actions'=>['login','error'],'allo

php - Guzzle 检测到 400 或 500 错误时如何防止崩溃?

我正在使用PHPguzzle我试过了publicstaticfunctionget($url){$client=newClient();try{$res=$client->request('GET',$url);$result=(string)$res->getBody();$result=json_decode($result,true);return$result;}catch(GuzzleHttp\Exception\ClientException$e){$response=$e->getResponse();$responseBodyAsString=$response->ge

PHP 警告 : file_get_contents failed to open stream: HTTP request failed! HTTP/1.1 400 错误请求

我已经使用Codeigniter构建了一个本地DVD数据库,其中包含电影名称等。我想要做的是从thisIMDBAPI加载更多电影数据。.但是我收到以下错误:APHPErrorwasencounteredSeverity:WarningMessage:file_get_contents(http://www.imdbapi.com/?i=&t=2Fast2Furious)[function.file-get-contents]:failedtoopenstream:HTTPrequestfailed!HTTP/1.1400BadRequestFilename:controllers/dv

php - 无法打开流 : HTTP request failed! HTTP/1.0 400 错误请求

这是我用来查找地点的纬度和经度的代码:functioncoords($address){echo$url="http://maps.googleapis.com/maps/api/geocode/json?address=".$address;$json=file_get_contents(urlencode($url));$data=json_decode($json,TRUE);print_r($data['results'][0]['geometry']['location']['lat']);print_r($data['results'][0]['geometry']['lo

php - Yii2 自定义 url 管理。出现 400 错误

嗯,PHP时代。我的客户希望我使用Yii2作为他项目的框架。我已经启动并运行了。没问题。我通过composer使用了高级模板。将我的网站根目录设置为/frontend/web等现在,我想使用这种url格式website.com/messages/或website.com/messages/tom...等现在设置方式显示website.com/index.php?r=messages/index...我找到了这个文档...https://github.com/yiisoft/yii2/blob/master/docs/guide/url.md但我似乎无法弄清楚。这是我的步骤...我将我的

PHP curl 错误请求 400 - mapquest 地理编码

我的网址是:http://www.mapquestapi.com/geocoding/v1/batch?key=dNBvDLtTx85L3akdg8vBoHQXrWpDJSEI&location=HEBRON,KY,US&location=CINCINNATI,KY,US&location=CINCINNATI,KY,US&location=BEDFORDPARK,IL,US&location=BEDFORDPARK,IL,US&location=HODGKINS,IL,US&location=HODGKINS,IL,US&location=HODGKINS,IL,US&locatio