草庐IT

Rest-Client

全部标签

php - REST API 请求参数验证 Laravel

我是LaravelAPI的新手。我正在尝试通过Laravel的验证方法验证发送到POST请求的参数。以下数据是我通过POST请求发送的唯一参数。我想使用Laravel的验证方法验证device_id的唯一性。data=>{"device_id":"xxxxxx2C-9EA3-4FFB-B26D-E8E483xxxxxx","password":"ANVp285x","user_type":"1"}我可以验证唯一的数据参数,但是没有正确的响应或错误消息它抛出异常。我的主要动机是验证device_id、password和user_type。这是我Controller的商店publicfun

php - REST 风格的 URLS 和 PHP

我真的很难理解如何使用REST风格的URLS。我能得到一点帮助吗?现在我有一个这样的查询字符串:example.com/calendar_expanded?date=1270094400我有一个隐藏.php扩展名的mod重写。我该怎么办让这calendar_expanded/date/1270094400发生。$_GET来自url的值?我喜欢它背后的概念,但为了在最后期限前完成整整一个月的工作,每天工作16小时对我的大脑造成了伤害。感谢您的帮助。 最佳答案 如果您想创建很多RESTURL,您应该考虑使用一个利用FrontContro

php - JIRA 使用 REST、PHP 和 cURL 更新自定义字段

我正在尝试使用RESTAPI和PHP/cURL更新一些自定义字段。我想知道我是否可能在没有意识到的情况下编辑了一些东西,而我下面的内容昨天“有效”(我认为),但现在不起作用。我使用不同的“方法”得到不同的响应,来自:我使用POST方法得到这个,因为它在下面没有注释。HTTP405-ThespecifiedHTTPmethodisnotallowedfortherequestedresource().如果我使用注释掉的PUT方法,并且POST被注释掉,我会得到这个。{"status-code":500,"message":"Readtimedout"}这一个混合和匹配PUT和POST。{

php - Symfony3 - 处理 JSON Rest API 错误的最佳方式?

我正在使用symfony3开发一个简单的RestAPI(仅限JSON)。我正在使用表单来验证实体,但我想不出一个足够好的方法来处理表单错误并返回有意义的json错误响应。这是来self的Controller的示例操作:/***@Route("/user/add",name="addUser")*@Method({"POST"})**@paramRequest$request*@returnJsonResponse*/publicfunctionregisterAction(Request$request){$user=newUser();$form=$this->createForm(

php - 私有(private) REST API

我们有RESTAPI,我们希望只有我们的域可以访问并且不发送欺骗请求。为此,我唯一想到的就是检查引荐来源$_SERVER['HTTP_REFERER']。然而docssaythat:Theaddressofthepage(ifany)whichreferredtheuseragenttothecurrentpage.Thisissetbytheuseragent.Notalluseragentswillsetthis,andsomeprovidetheabilitytomodifyHTTP_REFERERasafeature.Inshort,itcannotreallybetruste

php - Google Drive PHP Client Library 检索文件资源列表

我尝试在我的代码中使用这个函数:https://developers.google.com/drive/v2/reference/files/list如下:/***RetrievealistofFileresources.**@paramapiDriveService$serviceDriveAPIserviceinstance.*@returnArrayListofFileresources.*/functionretrieveAllFiles($service){$result=array();$pageToken=NULL;do{try{$parameters=array();i

php - REST 风格的 PHP : how does it work from client side to server side?

我对RESTfulPHP上的教程/示例感到困惑。他们中的大多数都在使用框架(例如Slim)并且最终成为API,这让我更加困惑。在彻底理解如何创建一个简单的RESTfulPHP之前,我想从一开始就避免所有框架和APIMaterial。我明白了,REST,atit'score,isreallyjustaboutusingtherightHTTPverbforthejob.GET,POST,PUT,DELETEallhavemeanings,andifsomethingisdescribedasbeingRESTful,allitreallymeansisthatthesite/appinq

php - FOSUserBundle 和 REST Api 调用 : How to use custom FormType?

我在我的Symfony2网站上使用FOSUserBundle。现在我正在开发一个API以允许通过RESTAPI调用进行注册。我已经覆盖了FOSUserBundle的RegistrationController:ApiRegistrationController.php:/***@Route("/user/",defaults={"_format"="json"},requirements={"_method"="POST"})**/publicfunctionregisterAction(Request$request){[...]$form=$formFactory->createF

php - 使用 HelloAnalyticsApi 时调用 Google Analytics 中未定义的方法 Google_Client

我正在使用核心报告API进行报告。我在我的本地主机服务器上安装了GooglePHPAPI客户端主机,并在我包含的src文件夹中创建了一个文件HelloAnalyticsAPI.phpGoogle/Client.php,Google/Service/Analytics.php文件。并使用以下详细信息$client->setClientId('XXXXXXXXXXX.apps.googleusercontent.com');$client->setClientSecret('XXXXXXXXXXX');$client->setRedirectUri('http://localhost/an

PHP stream_socket_client() 警告

我正在为一个客户建立一个新的WordPress网站,今天我突然在屏幕顶部看到这个错误。我以前从未见过这个。任何想法可能导致现在发生这种情况?还有怎么解决?Warning:stream_socket_client():php_network_getaddresses:getaddrinfofailed:Nameorservicenotknownin/var/www/wp-includes/class-http.phponline787Warning:stream_socket_client():unabletoconnecttotcp://www.MY-DOMAIN.com:80(php