Related applications and introductions to PHP's curl_setopt function

WBOY
Release: 2016-07-25 09:07:06
Original
1055 people have browsed it
  1. //Forum api login interface address
  2. $uri = "http//www.wap.com/ssdfasdfsf"
  3. //Parameter array
  4. $data = array(
  5. 'username' => 'username',
  6. 'password' => 'password',
  7. );
  8. //Operation execution
  9. $ch = curl_init();
  10. curl_setopt($ch, CURLOPT_URL, $uri);
  11. curl_setopt($ch, CURLOPT_POST, 1);
  12. curl_setopt($ch, CURLOPT_HEADER,1);
  13. curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  14. curl_exec($ch);
Copy code

Unify the two-day sessionid generation mechanism and transform forum wap users Authentication method.

2. Use PHP to implement QQ hang-up program

QQ hang-up is very popular nowadays. Recently I saw a certain expert wrote this piece of php code to implement QQ hang-up, so I would like to share it with you.

Network manager u.bitsCN.com PHP code:

  1. $qq = "100000"; //qq number
  2. $pwd = "123456"; //Password
  3. $ch = curl_init();
  4. curl_setopt($ch, CURLOPT_URL, "http ://211.139.167.71/waptest/TWF/qqportal/rela/updateuserinfo.jsp");
  5. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); //This line is to set whether curl follows the location sent by the header.
  6. Important
  7. curl_setopt($ch, CURLOPT_POST, 1);
  8. //curl_setopt($ch, "Connection", "Keep-Alive");
  9. curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  10. curl_setopt($ch, CURLOPT_POSTFIELDS, "qq =".$qq."&pwd=".$pwd."&FromWhere=register");
  11. $return = curl_exec($ch);
  12. curl_close($ch);
  13. echo strstr($return, "postfield") ? "Login failed" : "Login successful";
  14. ?>
Copy code

Notes: 1. Requires curl module support 2. After logging in, your friends will see that you are online 3. Don’t know how to log off.



source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template