PHP Classes

File: Example.php

Recommend this page to a friend!
  Classes of Dawood Ikhlaq   EasyCURL   Example.php   Download  
File: Example.php
Role: Example script
Content type: text/plain
Description: Curl_example
Class: EasyCURL
Simple wrapper around Curl to send HTTP requests
Author: By
Last change:
Date: 8 years ago
Size: 600 bytes
 

Contents

Class file image Download
<?php
   
require("Easycurl.class.php");
   
$url="http://192.168.15.1:8000/";
   
$data=array(
   
"auth_user"=>"admin",
   
"auth_pass"=>"admin",
   
"redirurl"=>"",
   
"accept"=>"ACCETTA+E+CONTINUA"
   
);
   
$options=array(
   
CURLOPT_URL=>$url,
   
CURLOPT_POST=> 1,
   
CURLOPT_POSTFIELDS=>http_build_query($data),
   
CURLOPT_FOLLOWLOCATION=> 1,
   
CURLOPT_RETURNTRANSFER=>1
   
);
   
   
$ch = new curl($options);
   
$result= $ch->result();
   
   
//echo $result.PHP_EOL;
   
   
if(strstr($result,'Logout'))
    {
       
printf("Login was Successfull\n");
    }else
    {
       
printf("Login was unSuccessfull\n");
    }
   
   
?>