post

Error 404 when receive POST

て烟熏妆下的殇ゞ 提交于 2020-01-21 20:04:07
问题 I need send a json POST from android to web server with php. I try a lot of codes but don't works. Now I try a simply POST with Postman, with and without send data. And always receive a 404 error. If I send data with GET the page work fine. See the php, for if you want to test: web: http://gclimb.com/Androidphp/index.php <?php $json = file_get_contents('php://input'); $obj = json_decode($json); echo $obj["username"]; echo $obj["pass"]; if ($_POST["username"]) { echo $_POST["username"]; } if (

httpPost请求用java代码实现的方法

末鹿安然 提交于 2020-01-21 11:57:41
原文:https://www.cnblogs.com/johnson-yuan/p/6713384.html package com.day3.sample; //首先下面我我们需要导入的jar包和文件 import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.http.Consts; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http

how to enable cross domain POST-ing in PHP?

泄露秘密 提交于 2020-01-21 06:27:27
问题 I'm tying to send POST data from one site to another (both sites have been developed by us). The problem is that the POST variables are not available if the page is requested from another domain. Even if I test it locally, but specify the complete url, the POST data is gone. So, this will work: <form method="POST" action="test.php"> But this will not: <form method="POST" action="http://example.com/test.php"> Here is the HTML for the page: <html> <head> <title></title> </head> <body> <form

How to grab data from post to a class

旧巷老猫 提交于 2020-01-21 05:21:25
问题 If I have a form such as (not all the code just one field and my input): <div id="login_form"> <form id="registration" method="post" action="results.php"> <label for="first_name"> First Name: </label> <input type="text" id="first_name" name="first_name" maxlength="100" tabindex="1" /> <input type="submit" id="login_submit" name="submit" value="Submit"/ align="right"> </form> </div> Is it possible to grab the data from the form and then output that data to another page. The way I have it now I

Entrust是一种为Laravel5添加基于角色的权限的简洁而灵活的方法。

こ雲淡風輕ζ 提交于 2020-01-21 00:02:16
安装 首先要在composer.json中添加: "zizaco/entrust": "5.2.x-dev" 然后运行composer install 或者 composer update 在 config.php的provider数组中添加: Zizaco\Entrust\EntrustServiceProvider::class, 在config.php的alias数组中添加: 'Entrust'=>Zizaco\Entrust\EntrustFacade::class, 如果你要使用中间件(要求5.1或更高版本),你需要在app\Http\kernel.php的routeMiddleware数组中添加: 'role'=>\Zizaco\Entrust\Middleware\EntrustRole::class, 'permission'=>\Zizaco\Entrust\Middleware\EntrustPermission::class, 'ability'=>\Zizaco\Entrust\Middleware\EntrustAbility::class, 配置 在config/auth.php设置属性值。这是值将被用于给entrust指定正确的用户表和模型。 你也可以发布这个包的配置以便进一步的配置表明和命名空间。 只要使�php artisan vendor

Vue学习笔记之组件基础

别来无恙 提交于 2020-01-20 20:49:33
组件基础 // 定 义 一个名 为 button-counter 的新 组 件 Vue.component( 'button-counter' , { data: function () { return { count: 0 } }, template: '<button v-on:click="count++">You clicked me {{ count }} times.</button>' }) 组件是可复用的 Vue 实例,且带有一个名字 。 所以它们与 new Vue 接收相同的 选项 ,例如 data 、 computed 、 watch 、 methods 以及生命周期 钩 子等。 仅 有的例外是像 el 这样根实例特有的选项 new Vue({ el: '#components-demo' }) 。 另外,一个 组 件的 data 选项必须是一个函 数 ,因此每个 实 例可以 维护 一份被返回 对 象的独立的拷 贝 ,如果 Vue 没有 这 条 规则 ,点 击 一个按 钮 就可能会影响到 其它所有 实 例 。 1 通 过 Prop 向子 组 件 传递 数据 (父 — 子) 例 1 Vue.component( 'blog-post' , { props: [ 'title' ], template: '<h3>{{ title }}</h3>' })

浅尝Vue.js组件(一)

夙愿已清 提交于 2020-01-20 18:23:11
本篇目录: 组件名 组件注册 全局注册 基础组件的自动化全局注册 局部注册 在模块系统中局部注册 Prop 单向数据流 Prop验证 类型检查 非Prop特性 替换/合并已有的特性 禁用特性继承 自定义事件 事件名 自定义组件的v-model 将原生事件绑定到组件 .sync修饰符 小结 组件名 1、使用 kebab-case Vue.component('my-component-name', { /* ... */ }) 2、使用 PascalCase Vue.component('MyComponentName', { /* ... */ }) 当使用 PascalCase (首字母大写命名) 定义一个组件时,你在引用这个自定义元素时两种命名法都可以使用。也就是说 和 都是可接受的。 直接在 DOM (即非字符串的模板) 中使用时只有 kebab-case 是有效的 组件注册 全局注册 Vue.component('my-component-name', { // ... 选项 ... }) 注册之后可以用在任何新创建的Vue跟实例(new Vue)的模版中。 基础组件的自动化全局注册 我们往往有很多功能单一的基础组件,而这些组件有经常会被各个功能组件频繁的用到。这就会导致每个功能组件都会有一长串基础组件的长列表。 如果使用了 webpack (或在内部使用了 webpack

Get和Post请求方式的区别

倾然丶 夕夏残阳落幕 提交于 2020-01-20 12:45:07
关于HTTP请求,GET方式和POST方式有什么区别呢? 这一点在面试中也经常会遇到,具体如下。 (1)提交数据的方式不同 GET 请求的数据会附在URL之后(即把数据放置在HTTP协议头<requestline>中),以“?”(英文问号)分隔URL和传输数据,多个参数用“&”连接,如login.action?name=hyddd&password=idontknow&verify=%E4%BD%A0 %E5%A5%BD(某个URL的其中一部分)。如果数据是英文字母、数字,则直接发送;如果是空格,则转换为“+”后发送;如果是中文、其他字符,则会用Base64加密字符串,得出“%E4%BD%A0%E5%A5%BD”后发送。 POST 把提交的数据放置在HTTP包的请求体<request-body>中。 因此,使用GET方式提交的数据会在地址栏中显示出来,而使用POST方式提交的数据不会在地址栏中显示。 (2)传输数据的大小不同 虽然HTTP没有对传输的数据大小进行限制,HTTP规范也没有对URL的长度进行限制,但是在实际开发中还会存在一些限制。 GET 特定浏览器和服务器对URL的长度有限制,如IE对URL长度的限制是2 083Byte。其他浏览器,如FireFox,其限制取决于操作系统。因此,使用GET方式提交时,传输的数据就会受到URL长度的限制。 POST

Python3使用openpyxl读写Excel文件

让人想犯罪 __ 提交于 2020-01-20 03:04:48
Python中常用的操作Excel的三方包有xlrd,xlwt和openpyxl等,xlrd支持读取.xls和.xlsx格式的Excel文件,只支持读取,不支持写入。xlwt只支持写入.xls格式的文件,不支持读取。 openpyxl不支持.xls格式,但是支持.xlsx格式的读取写入,并且支持写入公式等。 原始数据文件apis.xlsx内容: name method url data json result get接口 get https://httpbin.org/get?a=1&b=2 post表单接口 post https://httpbin.org/post {name: Kevin,age:1} post-json接口 post https://httpbin.org/post {name: Kevin,age: 21} 读取数据 读取所有数据 import openpyxl # 打开excel excel = openpyxl.load_workbook('apis.xlsx') # 有路径应带上路径 # 使用指定工作表 sheet = excel.active # 当前激活的工作表 # sheet = excel.get_sheet_by_name('Sheet1') # 读取所有数据 print(list(sheet.values)) # sheet.values

Make an http POST request to upload a file using python urllib/urllib2

非 Y 不嫁゛ 提交于 2020-01-20 00:59:05
问题 I would like to make a POST request to upload a file to a web service (and get response) using python. For example, I can do the following POST request with curl : curl -F "file=@style.css" -F output=json http://jigsaw.w3.org/css-validator/validator How can I make the same request with python urllib/urllib2? The closest I got so far is the following: with open("style.css", 'r') as f: content = f.read() post_data = {"file": content, "output": "json"} request = urllib2.Request("http://jigsaw.w3