Esempio n. 1
0
 private function Init()
 {
     self::$curlHandle = curl_init();
     $options = array('Content-Type: application/json', 'Accept: application/json', !is_null(self::$authKey) ? 'Authorization: Basic ' . self::$authKey : '', $this->params);
     curl_setopt(self::$curlHandle, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt(self::$curlHandle, CURLOPT_HTTPHEADER, $options);
 }
Esempio n. 2
0
 public function remove(CurlHandler $h)
 {
     curl_multi_remove_handle($this->_mh, $h->getHandle());
 }
Esempio n. 3
0
<?php

$con = mysql_connect("localhost", "root", "");
if (!$con) {
    die('Could not connect: ' . mysql_error());
}
mysql_select_db("", $con);
require_once '../lib/CurlHandler.class.php';
require_once '../lib/simple_html_dom.php';
//$uni_url=$_POST['code'];
// Mathematics Department :: Find the other urls using firebug (depID)!
//echo $uni_url."<br/>";
//$url=http://81.31.167.195:8081/edu/newLessonList/newLessonsList.jsp?depID=$uni_code;
//echo "URL=......................".$url;
//$mycurl=new CurlHandler("http://81.31.167.195:8081/edu/newLessonList/newLessonsList.jsp?depID=40");
$mycurl = new CurlHandler($_POST[code]);
//$mycurl->readCookie();
$post_data = array("depID" => "25", "hashMapParametersValue" => "null");
$mycurl->postData($post_data);
$out = $mycurl->execute();
$mycurl->close();
// page content
//echo $out;
// Root object
$dom = str_get_html($out);
// Finding tables!
$tables = $dom->find('table[class=contentTable]');
//clear table
$table = "course";
mysql_query("TRUNCATE {$table}");
foreach ($tables as $table) {
Esempio n. 4
0
 protected static function DELETEC($method)
 {
     $curl = new CurlHandler();
     return $curl->DELETE($method);
 }
Esempio n. 5
0
<?php

header('Cache-Control: no-cache, must-revalidate');
header('Expires: Sat, 26 Jul 1997 00:00:00 GMT');
header('Content-type: application/json');
require '../curlHandler.php';
$output = array('status' => '0', 'data' => array());
if (!isset($_GET['url']) || empty($_GET['url'])) {
    $output["error"] = "Please enter a url";
    outputAjax($output);
} else {
    $url = $_GET['url'];
}
$ch = new CurlHandler();
if (!$ch->send($url)) {
    $output["error"] = "no response";
    $output["url"] = $url;
    outputAjax($output);
} else {
    $output['status'] = 1;
    $output['data'] = $ch->responseBody;
    outputAjax($output);
}
function outputAjax($ajax)
{
    if ($ajax['status'] == 1) {
        // json must be utf8 encoded!
        $ajax['data'] = utf8_encode($ajax['data']);
    }
    echo json_encode($ajax);
    exit;