PHP uses CURL to obtain the address instance after the 302 jump. Directly run the code: Copy the code as follows: * return a 302 address * functioncurl_post_302 ($ url, $ vars) {$ chcurl_init (); curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 ); curl_s directly uploads the code:
The code is as follows:
/* Return a 302 address */
Function curl_post_302 ($ url, $ vars ){
$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 );
Curl_setopt ($ ch, CURLOPT_URL, $ url );
Curl_setopt ($ ch, CURLOPT_POST, 1 );
Curl_setopt ($ ch, CURLOPT_FOLLOWLOCATION, 1); // 302 redirect
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ vars );
$ Data = curl_exec ($ ch );
$ Headers = curl_getinfo ($ ch );
Curl_close ($ ch );
If ($ data! = $ Headers)
Return $ Headers ["url"];
Else
Return false;
}
The above curl_post_302 function can directly get the jump address of 302.
The response code is as follows:/* returns a 302 address */function curl_post_302 ($ url, $ vars) {$ ch = curl_init (); curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 ); curl_s...