Beispiel #1
1
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Log::info('========== Delete post ==========');
     $params = array('id' => $id);
     Log::info('Inputs', $params);
     $url = 'http://www.candychat.net/ajax.php?t=post&a=delete&post_id=' . $id . "&token=" . $this->api_token . "&user_id=" . $this->user->id . "&user_pass="******"&timeline_id=" . $this->user->id;
     $api_response = cURL::get($url);
     Log::info('Result', $api_response->toArray());
     //$response = substr($api_response->body, 10,3);
     $json = json_decode($api_response->body, true);
     if ($json['status'] == 200) {
         return Response::json(array('status' => '1', 'response_code' => 'Delete Success'));
     } else {
         return Response::json(array('status' => '0', 'response_code' => 'Delete Incomplete', 'debug' => $json));
     }
 }
function downloadVeoXml($video_id)
{
    $cc = new cURL();
    //To post data
    $postdata = "a=" . urlencode($a) . "&b=" . urlencode($b);
    $url = 'http://www.veoh.com/rest/video/' . $video_id . '/details';
    $xmlString = $cc->post($url, $postdata);
    return $xmlString;
}
 /**
  * Scrape URL
  *
  * Loads down a page of HTML, and runs it against a regex expression.
  * The results are retuned as an array, or as an object if matched names are provided.
  *
  * @param String $url 			The complete URL to the target page (http://www.example.com/)
  * @param String $regex			The regex pattern to test against
  * @param Array 	$match_names	An array of strings that will become the names of the object properties
  * @param Array 	$options		Any additional options for cURL
  *
  * NB: $match_names need to be in the same order as the parenthesised sections of the regex pattern
  * (eg. array( 'foo', 'bar' ) will become $object->foo, $object->bar, in that order)
  */
 static function scrape_url($url = '', $regex = '', $match_names = NULL, $options = NULL)
 {
     //create cURL class
     require_once 'curl.class.php';
     $curl = new cURL();
     //insert any additional options into cURL
     if (is_array($options)) {
         $curl->options($options);
     }
     //grab the HTML data
     $html = $curl->get($url);
     //scrape HTML
     return PageScraper::scrape_html($html, $regex, $match_names);
 }
Beispiel #4
0
Datei: cURL.php Projekt: hlag/svs
 /**
  *
  * @return cURL
  */
 public static function getInstance()
 {
     if (!isset(self::$instance))
     {
         self::$instance = new cURL();
     }
     return self::$instance;
 }
Beispiel #5
0
	public function __construct()
	{
		require_once("cURL.php");
                $file = 'http://www.hhu.de/home/fileadmin/redaktion/Oeffentliche_Medien/Presse/Pressemeldungen/Bilder/Haeussinger_www.bmp';
                $fileArray = explode('/',$file);
                echo "getFile".$file."NEW File".$fileArray[count($fileArray)-1];
                cURL::getInstance()->getFile($file, "/var/www/Administrator2.6.1/lib/cURL/test/", $fileArray[count($fileArray)-1]);
		
	}
 public function movie($id)
 {
     $url = "https://yts.re/api/movie.json?id=" . $id;
     if (Cache::has($url)) {
         return Cache::get($url);
     } else {
         $response = cURL::get($url);
         Cache::put($url, $response->body, 60);
         return $response->body;
     }
 }
Beispiel #7
0
 /**
  * Show all post regarding to user id.
  * @return Response
  */
 public function conversationList($id)
 {
     $url = "https://chat.vdomax.com:1313/api/chat/list/" . $id;
     $response = cURL::get($url);
     $response = $response->body;
     $json = json_decode($response, true);
     if (count($json) != 0) {
         return Response::json(array('status' => '1', 'conversations' => $json));
     } else {
         return Response::json(array('status' => '0', 'conversations' => $json));
     }
 }
Beispiel #8
0
  /**
   * Méthode pour envoyer une requête à l'annuaire
   * Retourne un tableau avec les infos ou une chaine d'erreur ou stoppe (exit).
   *
   * Pour [api] valeurs [ profs | eleves | parents ] prévues mais pas présentes.
   * Pour [api] valeurs [ classes | groupes ] n'apportent aucune informations intéressante supplémentaire.
   *
   * @param string $uai
   * @param string $api   '' | matieres | users
   * @param bool   $exit_if_error
   * @param bool   $with_details   Retourne la même chose sauf pour [api=''] qui ne renvoie que les infos sur l'établissement si [with_details=FALSE]
   * @return array
   */

  public static function get_info_from_annuaire($uai,$api,$exit_if_error,$with_details)
  {
    $annuaire_adresse   = ($api) ? Laclasse::ANNUAIRE_API_ETAB.$uai.'/'.$api : Laclasse::ANNUAIRE_API_ETAB.$uai ;
    $annuaire_tab_param = ($with_details) ? array('expand' => 'true') : array() ;

    $json_reponse = cURL::get_contents( Laclasse::generer_url_appel( $annuaire_adresse , $annuaire_tab_param ) );

    if(substr($json_reponse,0,6)=='Erreur')
    {
      // On récupère par exemple 
      // "Erreur : The requested URL returned error: 401 Unauthorized" si UAI étranger
      // "Erreur : The requested URL returned error: 404 Not Found"    si UAI inconnu
      if($exit_if_error)
      {
        exit( json_encode( array( 'error' => $uai.' '.$api.' - '.$json_reponse ) ) );
      }
      else
      {
        return $uai.' '.$api.' - '.$json_reponse;
      }
    }

    $tab_reponse = json_decode($json_reponse,TRUE);

    if($tab_reponse===NULL)
    {
      if($exit_if_error)
      {
        exit( json_encode( array( 'error' => $uai.' '.$api.' - Chaîne JSON incorrecte : '.$json_reponse ) ) );
      }
      else
      {
        return $uai.' '.$api.' - Chaîne JSON incorrecte : '.$json_reponse;
      }
    }
    elseif(isset($tab_reponse['error']))
    {
      // On récupère par exemple {"error":"Non authentifié"} si API non reconnue ou clef d'API incorrecte
      if($exit_if_error)
      {
        exit($json_reponse);
      }
      else
      {
        return $uai.' '.$api.' - Erreur réponse annuaire : '.$json_reponse;
      }
    }

    return $tab_reponse;
  }
Beispiel #9
0
 /**
  * Starts the download
  *
  * @author Art <*****@*****.**>
  * @return bool Whther the download was successful (on the cURL side)
  */
 function download()
 {
     if (file_exists($this->dest)) {
         unlink($this->dest);
     }
     $this->fp = fopen($this->dest, 'w');
     $this->curl->setopt(CURLOPT_FILE, $this->fp);
     $this->curl->exec();
     fclose($this->fp);
     $errno = $this->curl->errno();
     if ($errno === CURLE_OK) {
         return true;
     } else {
         _echo($this->curl->error());
         return false;
     }
 }
Beispiel #10
0
<?php

// Force the script to run in Command Line only
if (php_sapi_name() != 'cli') {
    die('This script must be run in the command line');
}
// Use CURL
include_once 'curl.php';
$myCurl = new cURL();
// Open the CSV with domain information
$row = 1;
if (($handle = fopen(realpath(__DIR__) . '/../edu-info.csv', 'r')) !== FALSE) {
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
        $num = count($data);
        // Only get screenshots from domains that were successful
        if ($data[3] == '200') {
            // Make sure the snapshots directory exists
            if (!is_dir(realpath(__DIR__) . '/../snapshots/html/')) {
                // Need to do some more work to ensure it is writable
                mkdir(realpath(__DIR__) . '/../snapshots/html/');
            }
            // Get the HTML of the homepage
            if (!$myCurl->save($data[1], realpath(__DIR__) . '/../snapshots/html/' . $data[0] . '.html')) {
                print_r('Error creating file: ' . realpath(__DIR__) . '/../snapshots/html/' . $data[0] . '.html' . "\n");
            }
            // Report Success
            print_r('Saved HTML for: ' . $data[0] . "\n");
        }
    }
    // Close the CSV
    fclose($handle);
Beispiel #11
0
 /**
  * Show all post regarding to user id.
  * @return Response
  */
 public function history_deprecated($id)
 {
     //return Post::getHistory(array($id), $this->page, $this->per_page, $this->type);
     Log::info('========== Follow post ==========');
     $params = array('id' => $id);
     $user = Account::find($id);
     //$user->birthday;
     //$user->gender;
     //$user->avatar;
     //$user->cover;
     $url = 'http://server-a.vdomax.com:8080/record/?user='******'body'];
     //$json["sample_url"] = "http://server-a.vdomax.com:8080/record/youlove-310115_23:59:46.flv";
     $history = json_decode($response, true);
     $data = [];
     $tmp = [];
     $i = 0;
     if ($history != null) {
         foreach ($history as $obj) {
             $liveId = Helpers::SK_getLiveHistoryId($obj['name']);
             $tmp['user_id'] = $id . "";
             $tmp['username'] = $user->username;
             $tmp['avatar'] = "https://www.vdomax.com/" . $user->avatar;
             $tmp['last_thumb'] = "https://www.vdomax.com/clips/rtmp/" . $user->username . ".png";
             //$tmp['url'] = "http://server-a.vdomax.com:8080/record/".$obj['name'].".flv";
             $tmp['url'] = "http://stream-1.vdomax.com:1935/vod/__definst__/mp4:" . $user->username . "/" . $user->username . "_xxx_" . $liveId . ".mp4/playlist.m3u8";
             //$tmp['transcode'] = "http://server-a.vdomax.com:8080/record/transcode/".$obj['name'].".flv-480x272.mp4";
             $tmp['thumb'] = "http://server-a.vdomax.com:8080/record/" . $obj['name'] . ".flv.png";
             $tmp['name'] = $obj['name'];
             $tmp['duration'] = $obj['duration'];
             $tmp['date'] = $obj['date'];
             if (isset($liveId)) {
                 $data[] = $tmp;
             }
         }
     } else {
         $data = null;
     }
     $json['count'] = count($data);
     $json['history'] = $data;
     return Response::json($json);
 }
 /**
  * Appel au serveur communautaire pour tester une authentification comme développeur.
  * 
  * @param string    $password_crypte
  * @return string   'ok' ou 'Mot de passe incorrect ! Patientez 10s avant une nouvelle tentative.'
  */
 public static function tester_auth_devel($password_crypte)
 {
   $tab_post = array();
   $tab_post['fichier']         = 'auth_devel_test';
   $tab_post['password_crypte'] = $password_crypte;
   $tab_post['version_prog']    = VERSION_PROG; // Le service web doit être compatible
   return cURL::get_contents(SERVEUR_COMMUNAUTAIRE,$tab_post);
 }
Beispiel #13
0
<?php

require '../cURL.php';
$client = new cURL();
$client->get('action', 'login');
$client->post('username', 'admin')->post('password', 'admin');
echo $client->navigate('http://localhost/uvt/curl/example/test.php');
// Vérification des fichiers de l'application en place
// ////////////////////////////////////////////////////////////////////////////////////////////////////

$fichier_import  = CHEMIN_DOSSIER_IMPORT.'verification.zip';
$dossier_dezip   = CHEMIN_DOSSIER_IMPORT.'SACoche'.DS;
$dossier_install = '.'.DS;

//
// 1. Récupération de l'archive <em>ZIP</em>...
//
if($action=='verif_file_appli_etape1')
{
  $tab_post = array();
  $tab_post['verification'] = 1;
  $tab_post['version'] = VERSION_PROG;
  $contenu_zip = cURL::get_contents( SERVEUR_TELECHARGEMENT , $tab_post , 60 /*timeout*/ );
  if(substr($contenu_zip,0,6)=='Erreur')
  {
    exit(']¤['.'pb'.']¤['.$contenu_zip);
  }
  FileSystem::ecrire_fichier($fichier_import,$contenu_zip);
  exit(']¤['.'ok'.']¤['."Décompression de l'archive&hellip;");
}

//
// 2. Décompression de l'archive...
//
if($action=='verif_file_appli_etape2')
{
  if(is_dir($dossier_dezip))
  {
 /**
  * Display suggestion list.
  *
  * @return Response
  */
 public function follow_suggestion($userId)
 {
     $user = Account::find($userId);
     $url = "";
     //if($user != null)
     $url = 'http://candychat.net/request.php?t=search&a=follow-suggestions-mobile&user_id=' . $user->id . "&user_pass="******"&token=asdffdsa&q=a";
     $api_response = cURL::get($url);
     $response = $api_response->toArray();
     $response = $response['body'];
     $json = json_decode($response, true);
     //return Response::json($json);
     $total_account = sizeof($json["suggestion"]);
     $users = array();
     foreach ($json["suggestion"] as $user) {
         $the_user = Account::find((int) $user["id"]);
         $the_user->avatar;
         $the_user->cover;
         $the_user->gender;
         $the_user->birthday;
         $the_user->is_following = Helpers::SK_isFollowing($the_user->id, $userId);
         $users[] = $the_user;
     }
     $response = array('status' => '1', 'total' => $total_account, 'users' => $users);
     return Response::json($response);
 }
 foreach ($DB_TAB as $DB_ROW) {
     $tab_radio[$DB_ROW['item_id']] = str_replace('value="' . $DB_ROW['saisie_note'] . '"', 'value="' . $DB_ROW['saisie_note'] . '" checked', $radio_boutons);
 }
 // récupérer les commentaires texte ou audio
 $msg_texte_url = '';
 $msg_texte_data = '';
 $msg_audio_autre = 'non';
 $DB_ROW = DB_STRUCTURE_COMMENTAIRE::DB_recuperer_devoir_commentaires($devoir_id, $eleve_id);
 if (!empty($DB_ROW)) {
     if ($DB_ROW['jointure_texte']) {
         $msg_texte_url = $DB_ROW['jointure_texte'];
         if (strpos($msg_texte_url, URL_DIR_SACOCHE) === 0) {
             $fichier_chemin = url_to_chemin($msg_texte_url);
             $msg_texte_data = is_file($fichier_chemin) ? file_get_contents($fichier_chemin) : 'Erreur : fichier avec le contenu du commentaire non trouvé.';
         } else {
             $msg_texte_data = cURL::get_contents($msg_texte_url);
         }
     }
     if ($DB_ROW['jointure_audio']) {
         $msg_audio_autre = 'oui';
     }
 }
 // lignes du tableau à retourner
 $lignes = '';
 foreach ($tab_liste_item as $item_id) {
     $DB_ROW = $DB_TAB_COMP[$item_id][0];
     $item_ref = $DB_ROW['item_ref'];
     $texte_socle = $DB_ROW['entree_id'] ? '[S] ' : '[–] ';
     $texte_lien_avant = $DB_ROW['item_lien'] ? '<a target="_blank" href="' . html($DB_ROW['item_lien']) . '">' : '';
     $texte_lien_apres = $DB_ROW['item_lien'] ? '</a>' : '';
     $boutons = isset($tab_radio[$item_id]) ? $tab_radio[$item_id] : str_replace('value="X"', 'value="X" checked', $radio_boutons);
Beispiel #17
0
 function post($link = '', $field = array())
 {
     include_once 'application/libraries/eac_curl.class.php';
     $options = array();
     $fields = array();
     $options['CURLOPT_AUTOREFERER'] = 1;
     $options['CURLOPT_CRLF'] = 1;
     $options['CURLOPT_NOPROGRESS'] = 1;
     $options['CURLOPT_RETURNTRANSFER'] = 1;
     $http = new cURL($options);
     $http->setOptions($options);
     $result = $http->post($link, $field);
     return $result;
 }
Beispiel #18
0
echo $DIR_SCRIPT_ROOT;
?>
image/busy8.png</idleImage>
		<idleImage><?php 
echo $DIR_SCRIPT_ROOT;
?>
image/busy9.png</idleImage>
		</mediaDisplay>

	</item_template>
<channel>
	<title>Weeb.tv</title>
	<menu>main menu</menu>
<?php 
$disk = $_GET["disk"];
$cc = new cURL();
ReadSettings();
LogIn();
$html = $cc->get("http://weeb.tv/channels/live");
$videos = explode('<fieldset onclick', $html);
unset($videos[0]);
$videos = array_values($videos);
foreach ($videos as $video) {
    $t1 = explode('<a href="', $video);
    $t2 = explode('"', $t1[1]);
    $lnk = $t2[0];
    $t1 = explode('<img src="', $video);
    $t2 = explode('"', $t1[1]);
    $image = $t2[0];
    $t1 = explode('">', $video);
    $t2 = explode('</a></p>', $t1[5]);
Beispiel #19
0
/**
 * Récupérer le numéro de la dernière version de SACoche disponible auprès du serveur communautaire.
 * 
 * @param void
 * @return string 'AAAA-MM-JJi' ou message d'erreur
 */
function recuperer_numero_derniere_version()
{
  $requete_reponse = cURL::get_contents(SERVEUR_VERSION);
  return (preg_match('#^[0-9]{4}\-[0-9]{2}\-[0-9]{2}[a-z]?$#',$requete_reponse)) ? $requete_reponse : 'Dernière version non détectée&hellip;' ;
}
<?php

set_time_limit(0);
error_reporting(E_ALL);
ini_set('display_errors', '1');
require_once 'class.curl.inc.php';
require_once 'simple_html_dom.php';
require_once 'simple_html_dom_node.php';
$curler = new cURL();
$html = $curler->get('http://zitate.net/');
$objHtml = str_get_html($html);
$filename = 'irc-bot-annoy-quotes.json';
if (!file_exists($filename)) {
    file_put_contents($filename, json_encode(array()));
}
$quotes = json_decode(file_get_contents($filename), true);
$max = 150;
for ($i = 0; $i < $max; $i++) {
    echo $i . DIRECTORY_SEPARATOR . $max . ' (' . count($quotes) . ')' . PHP_EOL;
    $html = $curler->get('http://zitate.net/');
    $objHtml = str_get_html($html);
    $posts = $objHtml->find('span.quote-quote');
    foreach ($posts as $post) {
        /** @var simple_html_dom_node $post */
        $quote = strip_tags($post->innertext());
        $qmd5 = md5($quote);
        if (!array_key_exists($qmd5, $quotes)) {
            echo $quote . PHP_EOL;
            $quotes[$qmd5] = $quote;
        }
    }
Beispiel #21
0
 public function updateStatusMessage($message)
 {
     $url = $this->site_url . "/updatestatus";
     // mastersite url to upload file
     $serial_number = $this->serial_number;
     $send_fields = array('serial_number' => $serial_number, 'message' => $message);
     $curl_req = new cURL($url);
     $curl_req->post($send_fields);
     //$curl_req->progress($serial_number);
     $result = $this->process_curl_auth($curl_req);
     // check auth....
     if (!$result['success']) {
         $result['action'] = self::UPDATESTATUS;
         return $result;
     }
     // ok...
     $response = $curl_req->get_response();
     $decoded = json_decode($response, true);
     $decoded['serial_number'] = $serial_number;
     $decoded['success'] = true;
     return $decoded;
 }
 public function httpDo($verb, $path, $query)
 {
     if (!in_array($verb, array('GET', 'POST'))) {
         return;
     }
     $ret = null;
     $auth = null;
     $url = $this->api_base_url . $path;
     if (isset($this->conf['API_KEY']) && $this->conf['API_KEY'] != '') {
         $auth = implode(':', array($this->conf['API_KEY'], $this->conf['API_SECRET']));
     }
     switch ($verb) {
         case 'GET':
             $headers = array('Accept: application/json');
             $query = http_build_query($query);
             $transfer = cURL::GET($url . '?' . $query, $auth, $headers, $this->user_agent);
             break;
         case 'POST':
             $headers = array('Content-Type: application/json', 'Accept: application/json', 'Content-Length: ' . strlen($query));
             $transfer = cURL::POST($url, $query, $auth, $headers, $this->user_agent);
             break;
     }
     if ($transfer['body'] === false) {
         $ret = array('errors' => array(array('code' => 'curl_error', 'status' => $transfer['error'])));
     } else {
         $ret = json_decode($transfer['body'], true);
     }
     return $ret;
 }
Beispiel #23
0
 function curlPost($link = '', $field = array())
 {
     $options = array();
     $fields = array();
     $options['CURLOPT_AUTOREFERER'] = 1;
     $options['CURLOPT_CRLF'] = 1;
     $options['CURLOPT_NOPROGRESS'] = 1;
     $options['CURLOPT_RETURNTRANSFER'] = 1;
     //login htpaswd
     if ($htpassInfo) {
         $options['CURLOPT_USERPWD'] = $htpassInfo;
         $options['CURLOPT_HTTPAUTH'] = CURLAUTH_ANY;
     }
     $http = new cURL($options);
     $http->setOptions($options);
     $result = $http->post($link, $field);
     return $result;
 }
Beispiel #24
0
 function UpdateBootstrapInfo(cURL $cc, $bootstrapUrl)
 {
     $fragNum = $this->fragCount;
     $retries = 0;
     // Backup original headers and add no-cache directive for fresh bootstrap info
     $headers = $cc->headers;
     $cc->headers[] = "Cache-Control: no-cache";
     $cc->headers[] = "Pragma: no-cache";
     while ($fragNum == $this->fragCount and $retries < 30) {
         $bootstrapPos = 0;
         LogDebug("Updating bootstrap info, Available fragments: " . $this->fragCount);
         $status = $cc->get($bootstrapUrl);
         if ($status != 200) {
             LogError("Failed to refresh bootstrap info, Status: " . $status);
         }
         $bootstrapInfo = $cc->response;
         ReadBoxHeader($bootstrapInfo, $bootstrapPos, $boxType, $boxSize);
         if ($boxType == "abst") {
             $this->ParseBootstrapBox($bootstrapInfo, $bootstrapPos);
         } else {
             LogError("Failed to parse bootstrap info");
         }
         LogDebug("Update complete, Available fragments: " . $this->fragCount);
         if ($fragNum == $this->fragCount) {
             LogInfo("Updating bootstrap info, Retries: " . ++$retries, true);
             usleep(4000000);
         }
     }
     // Restore original headers
     $cc->headers = $headers;
 }
Beispiel #25
0
            curl_setopt($process, CURLOPT_PROXY, $this->proxy);
        }
        curl_setopt($process, CURLOPT_POSTFIELDS, $data);
        curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($process, CURLOPT_POST, 1);
        $return = curl_exec($process);
        curl_close($process);
        return $return;
    }
    function error($error)
    {
        echo "cURL Error : {$error}";
        die;
    }
}
$URL = $_GET["url"];
echo "<?xml version='1.0' encoding='utf-8' ?>\n";
echo "<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";
$h = new cURL();
$html = $h->get($URL);
$ItemsOut .= "<channel>\n<title>Uloz.to</title>";
$t1 = explode('{ url: "', $html);
$t2 = explode('"', $t1[1]);
$link = $t2[0];
$t1 = explode('<title>', $html);
$t2 = explode(' |', $t1[1]);
$titulek = $t2[0];
$ItemsOut .= "\r\n\t\t\t<item>\r\n\t\t\t\t<title>Přehrát: <![CDATA[" . $titulek . "]]></title>\r\n\t\t\t\t<link>" . $link . "</link>\r\n\t\t\t\t<pubDate>Potvrďte pro začátek přehrávání</pubDate>\r\n\t\t\t\t<enclosure type=\"video/mp4\" url=\"" . $link . "\"/>\r\n\t\t\t</item>\n";
$ItemsOut .= "</channel>\n</rss>";
echo $ItemsOut;
$proxy_used        = (isset($_POST['f_proxy_used']))        ? 'oui'                                       : '';
$proxy_name        = (isset($_POST['f_proxy_name']))        ? Clean::texte($_POST['f_proxy_name'])        : '';
$proxy_port        = (isset($_POST['f_proxy_port']))        ? Clean::entier($_POST['f_proxy_port'])       : 0;
$proxy_type        = (isset($_POST['f_proxy_type']))        ? Clean::texte($_POST['f_proxy_type'])        : '';
$proxy_auth_used   = (isset($_POST['f_proxy_auth_used']))   ? 'oui'                                       : '';
$proxy_auth_method = (isset($_POST['f_proxy_auth_method'])) ? Clean::texte($_POST['f_proxy_auth_method']) : '';
$proxy_auth_user   = (isset($_POST['f_proxy_auth_user']))   ? Clean::texte($_POST['f_proxy_auth_user'])   : '';
$proxy_auth_pass   = (isset($_POST['f_proxy_auth_pass']))   ? Clean::texte($_POST['f_proxy_auth_pass'])   : '';

// ////////////////////////////////////////////////////////////////////////////////////////////////////
// Tester les réglages actuellement enregistrés
// ////////////////////////////////////////////////////////////////////////////////////////////////////

if($action=='tester')
{
  $requete_reponse = cURL::get_contents(SERVEUR_VERSION);
  $affichage = (preg_match('#^[0-9]{4}\-[0-9]{2}\-[0-9]{2}[a-z]?$#',$requete_reponse)) ? '<label class="valide">Échange réussi avec le serveur '.SERVEUR_PROJET.'</label>' : '<label class="erreur">Échec de l\'échange avec le serveur '.SERVEUR_PROJET.' &rarr; '.$requete_reponse.'</label>' ;
  exit('<h2>Résultat du test</h2>'.$affichage);
}

// ////////////////////////////////////////////////////////////////////////////////////////////////////
// Enregistrer des nouveaux réglages
// ////////////////////////////////////////////////////////////////////////////////////////////////////

FileSystem::fabriquer_fichier_hebergeur_info( array(
  'SERVEUR_PROXY_USED'        => $proxy_used,
  'SERVEUR_PROXY_NAME'        => $proxy_name,
  'SERVEUR_PROXY_PORT'        => $proxy_port,
  'SERVEUR_PROXY_TYPE'        => $proxy_type,
  'SERVEUR_PROXY_AUTH_USED'   => $proxy_auth_used,
  'SERVEUR_PROXY_AUTH_METHOD' => $proxy_auth_method,
Beispiel #27
0
            curl_setopt($process, CURLOPT_PROXY, $this->proxy);
        }
        curl_setopt($process, CURLOPT_POSTFIELDS, $data);
        curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt($process, CURLOPT_FOLLOWLOCATION, TRUE);
        curl_setopt($process, CURLOPT_POST, TRUE);
        $return = curl_exec($process);
        curl_close($process);
        return $return;
    }
}
// EXAMPLE:
/*
$options = array
(
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
);
$cc = new cURL($options); 
*/
$cc = new cURL();
$tss1 = $cc->get('http://www.healthspace.ca/Clients/VDH/LFairfax/LFairfax_Website.nsf/Food-FacilityHistory?OpenView&RestrictToCategory=57727DA855A77D1E85257508007515D7');
/*
$parameters = array
(
    'foo' => 'bar'
);
$cc->post('http://www.example.com', $parameters); 
*/
#$cc->post('http://www.example.com','foo=bar');
echo $tss1;
    $quiet = true;
    $showHeader = false;
}
if ($cli->getParam('help')) {
    $cli->displayHelp();
    exit(0);
}
// Check for required extensions
$required_extensions = array("bcmath", "curl", "SimpleXML");
$missing_extensions = array_diff($required_extensions, get_loaded_extensions());
if ($missing_extensions) {
    $msg = "You have to install the following extension(s) to continue: '" . implode("', '", $missing_extensions) . "'";
    LogError($msg);
}
// Initialize classes
$cc = new cURL();
$f4f = new F4F();
$f4f->baseFilename =& $baseFilename;
$f4f->debug =& $debug;
$f4f->fixWindow =& $fixWindow;
$f4f->format =& $format;
$f4f->metadata =& $metadata;
$f4f->outDir =& $outDir;
$f4f->outFile =& $outFile;
$f4f->play =& $play;
$f4f->rename =& $rename;
// Process command line options
if (isset($cli->params['unknown'])) {
    $baseFilename = $cli->params['unknown'][0];
}
if ($cli->getParam('debug')) {
Beispiel #29
0
        }
        curl_setopt($process, CURLOPT_POSTFIELDS, $data);
        curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($process, CURLOPT_POST, 1);
        $return = curl_exec($process);
        curl_close($process);
        return $return;
    }
    function error($error)
    {
        echo "<center><div style='width:500px;border: 3px solid #FFEEFF; padding: 3px; background-color: #FFDDFF;font-family: verdana; font-size: 10px'><b>cURL Error</b><br>{$error}</div></center>";
        die;
    }
}
$cc = new cURL();
$loginXML = $cc->post("http://localhost/develwiki/api.php", "action=login&lgname=WikiSysop&lgpassword=root&format=xml");
echo $loginXML;
$editToken = $cc->post("http://localhost/develwiki/api.php", "action=query&prop=info|revisions&intoken=edit&titles=Main%20Page&format=xml");
$editToken = substr($editToken, strpos($editToken, "<?xml"));
echo "\n\nEdit token: {$editToken}\n";
$domDocument = new DOMDocument();
$cookies = array();
$success = $domDocument->loadXML($editToken);
$domXPath = new DOMXPath($domDocument);
$nodes = $domXPath->query('//page/@edittoken');
$et = "";
foreach ($nodes as $node) {
    $et = $node->nodeValue;
}
$et = urlencode($et);
Beispiel #30
-1
 /**
  * Display suggestion list.
  *
  * @return Response
  */
 public function follow_suggestion()
 {
     $url = 'https://www.vdomax.com/ajax.php?t=search&a=follow-suggestions-mobile&user_id=' . $this->user->id . "&user_pass="******"&token=" . $this->api_token;
     $api_response = cURL::get($url);
     $response = $api_response->toArray();
     $response = $response['body'];
     $json = json_decode($response, true);
     //return Response::json($json);
     $total_account = sizeof($json["suggestion"]);
     $response = array('status' => '1', 'total' => $total_account, 'users' => $json["suggestion"]);
     return Response::json($response);
 }