php function Tempnam ()

Source: Internet
Author: User

Description of the function: http://php.net/manual/zh/function.tempnam.php

The Tempnam function can produce a file name with a unique file name in the specified directory. Typically applies to custom session file names.

This function is still very useful. For example, if we are going to use curl to forge a session, then we can use it.

Related information: http://www.phpjx.com/show_5919.html

<?php function Vlogin ($url, $request) {session_start (); $cookie _jar = Tempnam ('./tmp ', ' cookie ');//A temporary file that generates a random file name in the current directory $ch = Curl_init ($url);    Initialize the Curl module curl_setopt ($ch, Curlopt_header, 0);    curl_setopt ($ch, Curlopt_returntransfer, 1); curl_setopt ($ch, Curlopt_post, 1);//post Way to submit curl_setopt ($ch, Curlopt_postfields, $request);//To submit the content//return $cookie_     The cookie information from the jar is stored in the $cookie_jar file curl_setopt ($ch, Curlopt_cookiejar, $cookie _jar);     $xianshi =curl_exec ($ch); Curl_close ($ch); Get data after login $curl = "http://phpjx.local.com/login/session/show.php";//the page to crawl the page, which has session judgment permission $ch =curl_    Init ($curl);    curl_setopt ($ch, Curlopt_header, 0);    curl_setopt ($ch, Curlopt_returntransfer, 1);     curl_setopt ($ch, Curlopt_post, 1);    curl_setopt ($ch, Curlopt_postfields, "sitename=phpjx.com&siteurl=http://www.phpjx.com");    curl_setopt ($ch, Curlopt_cookiefile, $cookie _jar);    $xianshi =curl_exec ($ch);    Curl_close ($ch); return $xianshi;   } $url = "http://phpjx.local.com/login/session/check.php";//We pass a value to the page to generate the session and then pass it to the page you want to crawl $request = "username    =yansy "; Echo Vlogin ($url, $request)?>


Can self-Baidu a bit of relevant information.

php function Tempnam ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.