Permalink
Browse files

Fixed non-working cURL method and API documentation issue. (thanks Ka…

…ragath)
  • Loading branch information...
1 parent 4dbe520 commit 2c14fb02948c5751f339285bf2e8a2586cc47eaa Purgox committed Apr 16, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 DuckDuckGo/API.php
  2. 0 README.markdown → README.md
View
@@ -6,16 +6,16 @@
* It will also include any necessary classes.
* With this interface, you can currently only perform ZeroClickInfo queries.
* Simple example:
- * $api = new DuckDuckGo\\API();
+ * $api = new DuckDuckGo\API();
* $info = $api->zeroClickQuery('Internet Relay Chat');
* echo $info->definition;
*/
namespace DuckDuckGo;
/* Include the necessary classes. */
-require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'APIResult.php');
-require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ZeroClickInfo.php');
+require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'APIResult.php';
+require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ZeroClickInfo.php';
class API
{
@@ -96,14 +96,14 @@ protected function getAPIResult($section, $options)
{
$url = $this->constructURL($section, $options);
- if(\function_exists('curl_init')) {
+ if(\extension_loaded('curl')) {
$curl = \curl_init($url);
\curl_setopt($curl, CURLOPT_HEADER, FALSE);
\curl_setopt($curl, CURLOPT_FOLLOWLOCATION, FALSE);
\curl_setopt($curl, CURLOPT_FRESH_CONNECT, TRUE);
\curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
- $result = \curl_exec($ch);
+ $result = \curl_exec($curl);
\curl_close($curl);
return $result;
File renamed without changes.

0 comments on commit 2c14fb0

Please sign in to comment.