post

How can I log in to morningstar.com without using a headless browser such as selenium?

允我心安 提交于 2020-01-10 03:16:39
问题 I read the answer to the question: "How to “log in” to a website using Python's Requests module?" The answer reads: "Firstly check the source of the login form to get three pieces of information - the url that the form posts to, and the name attributes of the username and password fields." How can I see, what the name attributes for username and password are for this morningstar.com page? https://www.morningstar.com/members/login.html I have the following code: import requests url = 'http:/

Using post data and xlmlhttp

北慕城南 提交于 2020-01-10 02:17:08
问题 I am still trying to learn more about scraping and I could devise a code that enables me to get the desired results. Here's the code Sub Test() Dim e As Variant Dim ie As Object Dim ulElem As Object Dim liElem As Object Dim anchElem As Object Dim dt As Date Dim lDay As Integer Dim lMnth As Integer Dim lYear As Integer Dim r As Long Set ie = CreateObject("InternetExplorer.Application") dt = Date - 2 lDay = Day(dt) lMnth = Month(dt) lYear = Year(dt) With ie .Visible = False .Navigate "http:/

django-blog:多对多查询

时间秒杀一切 提交于 2020-01-09 22:30:01
简单写一下多对多查询 model 不是多对多的字段我就没写上来的 class Tag(models.Model): name = models.CharField(max_length=20,verbose_name='标签') add_time = models.DateField(default=datetime.now) class Meta: verbose_name = '标签' verbose_name_plural = verbose_name def __str__(self): return self.name class Post(models.Model): tag = models.ManyToManyField(Tag,verbose_name="标签",null=True,blank=True,related_name='tags') add_time = models.DateField(default=datetime.now) class Meta: verbose_name = "文章" verbose_name_plural = verbose_name def __str__(self): return self.name   在编写view时 我需要 查出 某一篇文章 他所拥有的tags 和然后利用这些tags进行相关推荐 该如何查询

update

假装没事ソ 提交于 2020-01-09 16:45:48
<?php if (empty($_GET['id'])) { exit('没有接收到id'); } $id=$_GET['id']; $conn=mysqli_connect('127.0.0.1','root','123456','demo'); if (!$conn){ exit('没有连接到数据库'); } $data=mysqli_query($conn,"select * from users where id={$id} limit 1;"); if (empty($data)){ exit('查找不成功');} $user = mysqli_fetch_assoc($data);//关联数组 var_dump($user); if (empty($user)){ exit('没有数据'); } function update(){ global $user; if (empty($_POST['name'])){ $GLOBALS['err_message']='请输入姓名'; return; } if($_POST['gender']==='-1'&&empty($_POST['gender'])){ $GLOBALS['err_message']='请选择性别'; return; } $user['name']=$_POST['name']; $user[

PHP $_POST array variables are truncated

谁都会走 提交于 2020-01-09 11:14:11
问题 I am using PHP 5.3.8 with Apache 2.0. I am also using Symfony 2 but that's not where the script is failing. I have a form with array variables: <form action="/app_dev.php/admin/position/create" method="post"> <input type="text" id="po_name" name="po[name]" required="required" maxlength="50"> <input type="text" id="po_role" name="po[role]" required="required" maxlength="20"> </form> Directly in the app_dev.php file (to rule out Symfony from the problem) I do: echo file_get_contents("php:/

Post request to include 'Content-Type' and JSON

浪子不回头ぞ 提交于 2020-01-09 10:07:19
问题 I'm to work with goo.gl for URL shortening. I need to make the following request: POST https://www.googleapis.com/urlshortener/v1/url Content-Type: application/json {"longUrl": "http://www.google.com/"} my html:- <form method="post" action="https://www.googleapis.com/urlshortener/v1/"> <button type="submit"> submit </button> </form> how do i add the 'content-type' and json here? 回答1: Browsers do not support JSON as a media type for form submissions (the supported types are listed in the spec)

Post request to include 'Content-Type' and JSON

谁都会走 提交于 2020-01-09 10:03:40
问题 I'm to work with goo.gl for URL shortening. I need to make the following request: POST https://www.googleapis.com/urlshortener/v1/url Content-Type: application/json {"longUrl": "http://www.google.com/"} my html:- <form method="post" action="https://www.googleapis.com/urlshortener/v1/"> <button type="submit"> submit </button> </form> how do i add the 'content-type' and json here? 回答1: Browsers do not support JSON as a media type for form submissions (the supported types are listed in the spec)

ASP.NET MVC使用jQuery来POST数据至数据库中

房东的猫 提交于 2020-01-09 05:37:57
学习ASP.NET MVC程序,结合jQuery客户端代码,Post数据至数据库去。Insus.NET今天写一个完整性的例子。 在数据库中,创建一个表[dbo].[TestUser]: 既然是把数据存入数据库中,得先在数据库创建一个存储过程[dbo].[usp_TestUser_Insert]: 程序与数据库连接以及逻辑处理,使用这个 http://www.cnblogs.com/insus/archive/2010/01/23/1654653.html 在MVC中,需要创建一个模型Insus.NET.Models.TestUser: 接下来,创建一个实体Insus.NET.Entities.TestUserEntity: 控制器MarchY15Contoller添加一个视图操作PostDataToDataBase(): 创建视图: 在实现jQuery代码这前,得回至控制器,写一个PostData的操作方法 此时我们可以写JQuery代码了: 演示: 包括本篇及以前所有ASP.NET MVC,jQuery源程序代码以及数据库: http://download.cnblogs.com/insus/MVC/InsusMVCSiteCS20150306.rar 来源: https://www.cnblogs.com/insus/p/4317996.html

WordPress页面函数功能代码调用大全

◇◆丶佛笑我妖孽 提交于 2020-01-08 21:06:28
WordPress模板基本文件 style.css 样式表文件 index.php 主页文件 single.php 日志单页文件 page.php 页面文件 archvie.php 分类和日期存档页文件 searchform.php 搜索表单文件 search.php 搜索yemian文件 comments.php 留言区域文件(包括留言列表和留言框) 404.php 404错误页面 header.php 网页头部文件 sidebar.php 网页侧边栏文件 footer.php 网页底部文件 WordPress Header头部 <?php bloginfo(’name’); ?> 网站标题 <?php wp_title(); ?> 日志或页面标题 <?php bloginfo(’stylesheet_url’); ?> WordPress主题样式表文件style.css的相对地址 <?php bloginfo(’pingback_url’); ?> WordPress博客的Pingback地址 <?php bloginfo(’template_url’); ?> WordPress主题文件的相对地址 <?php bloginfo(’version’); ?> 博客的WordPress版本 <?php bloginfo(’atom_url’); ?>

WordPress百度熊掌号页面改造(纯代码实现)

拥有回忆 提交于 2020-01-08 04:26:49
一、粉丝关注改造 1.添加熊掌号ID声明 ID声明 1 <script src="//msite.baidu.com/sdk/c.js?appid=你的熊掌ID"></script> 这个没什么好说的,把这段代码放到你的header.php页面的相应合适位置就好。 2.添加关注功能代码(强烈推荐) 这个也不赘述了,有吸顶bar,文章段落间bar,底部bar三种,加在页面<body> 标签后就可以了,wordpress中一般是footer.php中。如果你想要自定义一些样式熟悉也可以选择添加下面类型的代码: 1 <div style="padding-left: 17px; padding-right: 17px;"> 2 <script>cambrian.render('head')</script> 3 </div> 二、 结构化改造( 划重点 ) 1.添加canonical标签 要求href的内容为MIP页或H5页对应的PC页地址;如果没有PC页,则填写当前页面地址。 1 <link rel="canonical" href="http(s)://xxx"/> 看到这别慌,是不是不知道地址页怎么填了,因为wordpress都是发表文章自动生成地址,我们总不能发表一个改一个,其实只要把以下代码放入你的header.php页面就好了,可以自动获取文章地址。 1 <?php 2