コード例 #1
0
 /**     
  * Query Wrapper for Curl Transport 
  * @access private
  * @param String $url
  * returns String $response
  */
 private function requestCurl($url)
 {
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $this->url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_REFERER, !empty($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "");
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $url);
     $body = curl_exec($ch);
     curl_close($ch);
     return GTranslate::evalResponse(json_decode($body));
 }
コード例 #2
0
ファイル: GTranslate.php プロジェクト: mfavetti/LimeSurvey
 /**     
  * Query Wrapper for Curl Transport 
  * @access private
  * @param String $url
  * returns String $response
  */
 private function requestCurl($url)
 {
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $this->url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_REFERER, $this->http_referer);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $url);
     $body = curl_exec($ch);
     curl_close($ch);
     return GTranslate::evalResponse(json_decode($body));
 }