Home php教程 php手册 关于PHPFetion不能给好友发送飞信的问题

关于PHPFetion不能给好友发送飞信的问题

Jun 06, 2016 pm 08:07 PM
cannot about send friends new version question Fetion

(最新版本下载:http://code.google.com/p/php-fetion/downloads/detail?name=phpfetion_v1.3.0.zip) 最近一直有网友反映,PHPFetion类不能给好友发送飞信了,但给自己还可以。通过网友的提示以及我自己的研究发现,在wap飞信中给好友发信息时,加了个csrf

(最新版本下载:http://code.google.com/p/php-fetion/downloads/detail?name=phpfetion_v1.3.0.zip)

最近一直有网友反映,PHPFetion类不能给好友发送飞信了,但给自己还可以。通过网友的提示以及我自己的研究发现,在wap飞信中给好友发信息时,加了个csrfToken字段。

不出意料的话,这个csrfToken应该就是起个防止表单跨站提交的作用。但由于这个csrfToken明文出现在了给好友发飞信的表单页面里,所以获取它也很容易。并且这个csrfToken在给其他任何好友发飞信时,都是不变的,所以只需要获取一次即可。

我写了如下代码来获取csrfToken:

/**
 * csrfToken
 * @param string
 */
protected $_csrfToten = null;
/**
 * 获取csrfToken,给好友发飞信时需要这个字段
 * @param string $uid 飞信ID
 * @return string
 */
protected function _getCsrfToken($uid)
{
    if ($this->_csrfToten === null)
    {
        $uri = '/im/chat/toinputMsg.action?touserid='.$uid;
        $result = $this->_postWithCookie($uri, '');
        preg_match('/name="csrfToken".*?value="(.*?)"/', $result, $matches);
        $this->_csrfToten = isset($matches[1]) ? $matches[1] : '';
    }
    return $this->_csrfToten;
}
Copy after login

另外也修改了给好友发飞信的_toUid()函数:

/**
 * 向好友发送飞信
 * @param string $uid 飞信ID
 * @param string $message 短信内容
 * @return string
 */
protected function _toUid($uid, $message)
{
    $uri = '/im/chat/sendMsg.action?touserid='.$uid;
    $csrfToken = $this->_getCsrfToken($uid);
    $data = 'msg='.urlencode($message).'&csrfToken='.$csrfToken;
    $result = $this->_postWithCookie($uri, $data);
    return $result;
}
Copy after login

写好的代码依然放在了Google Code中,并打包成了最新版本PHPFetion v1.3,下载地址为:http://code.google.com/p/php-fetion/downloads/list。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1657
14
PHP Tutorial
1257
29
C# Tutorial
1230
24
How to retrieve deleted WeChat friends How to retrieve deleted WeChat friends How to retrieve deleted WeChat friends How to retrieve deleted WeChat friends Feb 22, 2024 pm 05:52 PM

In the add friend option of WeChat, enter the other party's WeChat ID and click Add. Tutorial Applicable Model: iPhone13 System: iOS15.3.1 Version: WeChat 8.0.19 Analysis 1 First, click the plus icon in the upper right corner of the WeChat homepage. 2 Then click Add Friends in the pop-up options. 3. Then enter the add friend page and enter the other party’s WeChat ID. 4After searching for the friend, click Add to Address Book to add the friend. Supplement: How to delete WeChat friends 1. First open and log in to WeChat, click on the address book at the bottom of the WeChat main page. 2Click to enter the homepage of the friend you want to delete, and click the three dots icon in the upper right corner of the page. 3 Enter the profile settings and click the delete option at the bottom of the page to delete friends. Summary/Precautions What are the friends deleted by WeChat?

How do I know if the other party has deleted me on WeChat - How to determine whether I have been deleted by a friend How do I know if the other party has deleted me on WeChat - How to determine whether I have been deleted by a friend Mar 18, 2024 pm 07:58 PM

WeChat is one of the most popular social applications currently, and friend management is an inevitable part of daily use. Sometimes, we may be curious whether certain friends have deleted us, but we don’t want to ask directly or cause embarrassment. Below, the editor has compiled 4 methods to check whether WeChat friends have deleted you. Let’s take a look! Method 1. Send a message directly The simplest and most direct method is to try to send a message to the other party. If the other party has deleted you, WeChat will prompt "The other party has turned on friend verification, and you are not his (her) friend yet. Please send a friend verification request first, and you can only chat after the other party has passed the verification." Method 2: Initiate a video or voice call Trying to initiate a video or voice call to the other party is also an effective method. If the other party has deleted you, the call will

How to send files to others on TikTok? How to delete files sent to others? How to send files to others on TikTok? How to delete files sent to others? Mar 22, 2024 am 08:30 AM

On Douyin, users can not only share their life details and talents, but also interact with other users. In this process, sometimes we need to send files to other users, such as pictures, videos, etc. So, how to send files to others on Douyin? 1. How to send files to others on Douyin? 1. Open Douyin and enter the chat interface where you want to send files. 2. Click the "+" sign in the chat interface and select "File". 3. In the file options, you can choose to send pictures, videos, audio and other files. After selecting the file you want to send, click "Send". 4. Wait for the other party to accept your file. Once the other party accepts it, the file will be transferred successfully. 2. How to delete files sent to others on Douyin? 1. Open Douyin and enter the text you sent.

How to retrieve deleted WeChat friends How to add deleted WeChat friends back How to retrieve deleted WeChat friends How to add deleted WeChat friends back Feb 22, 2024 pm 03:30 PM

You can search for the other party's WeChat ID on the add friend interface to retrieve it. Tutorial Applicable Model: iPhone13 System: iOS15.5 Version: WeChat 8.0.19 Analysis 1 Click the plus button in the upper right corner of the WeChat main interface. 2 Then click the Add Friend option in the pop-up window. 3 Next, enter the friend’s WeChat ID in the pop-up Add Friend page. 4. After finally searching for the friend, click Add to Address Book. Supplement: How to delete WeChat friends 1. First open WeChat and click on the address book at the bottom of the home page. 2 Then click on the friend you want to delete in the address book. 3Then click the three-dot button in the upper right corner of the details page. 4 Next, click the Delete option on the pop-up page. 5Finally, click Delete Contact. Summary/Notes

Clustering effect evaluation problem in clustering algorithm Clustering effect evaluation problem in clustering algorithm Oct 10, 2023 pm 01:12 PM

The clustering effect evaluation problem in the clustering algorithm requires specific code examples. Clustering is an unsupervised learning method that groups similar samples into one category by clustering data. In clustering algorithms, how to evaluate the effect of clustering is an important issue. This article will introduce several commonly used clustering effect evaluation indicators and give corresponding code examples. 1. Clustering effect evaluation index Silhouette Coefficient Silhouette coefficient evaluates the clustering effect by calculating the closeness of the sample and the degree of separation from other clusters.

How to recover deleted WeChat friends How to recover deleted WeChat friends How to recover deleted WeChat friends How to recover deleted WeChat friends Feb 22, 2024 pm 06:30 PM

Select the plus button on the homepage and select Add Friend, then enter the friend's WeChat ID to add it to the address book. Tutorial Applicable Model: iPhone 13 System: IOS 15.3 Version: WeChat 8.0.20 Analysis 1 First open WeChat and click the plus button in the upper right corner of the homepage. 2 Then click the Add Friend option in the pop-up window. 3 Next, enter the friend’s WeChat ID in the pop-up Add Friend page. 4. After finally searching for the friend, click Add to Address Book. Supplement: How to delete WeChat friends 1. First open WeChat and click on the address book at the bottom of the homepage. 2 Then click on the friend you want to delete in the address book. 3Then click the three-dot button in the upper right corner of the details page. 4 Next, click the Delete option on the pop-up page. 5

How to listen to music with friends in qq music How to create a room to listen to music together in qq music How to listen to music with friends in qq music How to create a room to listen to music together in qq music Mar 21, 2024 pm 12:10 PM

QQ music allows everyone to immerse themselves in it, listen to music to relieve boredom, listen to high-quality songs every day, and spend every day. If you feel lonely listening to music alone, you can also connect with others online here to achieve You can accompany each other when you are not around and enjoy listening to music simultaneously and in real time. It is very good with friends and couples. It is also very simple to operate. If you don’t know how to use it, you can also come here to view the tutorial. The editor will teach you how. Use this software feature! 1. After entering QQ Music, open a song list to enter the song playback interface, and click Share in the upper right corner. 2. Click [Invite friends to listen together] at the bottom of the sharing menu. 3. Share the link to invite friends to listen to the song with them, and they can click the link.

Teach you how to diagnose common iPhone problems Teach you how to diagnose common iPhone problems Dec 03, 2023 am 08:15 AM

Known for its powerful performance and versatile features, the iPhone is not immune to the occasional hiccup or technical difficulty, a common trait among complex electronic devices. Experiencing iPhone problems can be frustrating, but usually no alarm is needed. In this comprehensive guide, we aim to demystify some of the most commonly encountered challenges associated with iPhone usage. Our step-by-step approach is designed to help you resolve these common issues, providing practical solutions and troubleshooting tips to get your equipment back in peak working order. Whether you're facing a glitch or a more complex problem, this article can help you resolve them effectively. General Troubleshooting Tips Before delving into specific troubleshooting steps, here are some helpful

See all articles