Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Php string to plastic
Php string to plastic
Sendcheck($url, $code)

{

Global $ logger

$ ch = curl _ init();

If (! $ ch)return- 1; //Set the appropriate parameters

curl_setopt($ch,CURLOPT_URL,$ URL); //connection

If (! curl_setopt($ch,CURLOPT_HEADER,0))return-2; //Send, set curl_exec to return the execution result, and successfully return the obtained content, otherwise it is false.

curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1); //The return value is empty.

If (! curl_setopt($ch,CURLOPT_TIMEOUT,30))return-3; //The maximum time to perform a curl operation is1s.

If (! curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,30))return-4; //curl's external time is 10 s.

$ result = curl _ exec($ ch); //Access resources;

//The server failed to respond or the network connection was mishandled, requesting information retransmission, at most 10 times, with an interval of 10 s each time.

for($ I = 0; $ i & lt= 9; $i++ ){

If (! $result){ // No data was obtained last time.

$ result = curl _ exec($ ch); //Next data transmission;

} Otherwise {

$ logger-& gt; Info ("notification of success");

Break;

}

}

If (! $result){

$ logger-& gt; Info ("notification failed");

}

curl _ close($ ch); //Close curl resource

}