Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/YOURLS/YOURLS.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeoColomb <leocolombaro@yahoo.fr>2013-04-07 14:52:52 +0400
committerLeoColomb <leocolombaro@yahoo.fr>2013-04-07 14:52:52 +0400
commit3daf6593d89c608a6660a6c0b872eeb2607548ba (patch)
treef7ca7b29ac8a4e787e3602fe5efef7a9e65e937a /sample-remote-api-call.txt
parent37d0d35407c96799a8dcdd968575d519ec2cb151 (diff)
Fix end of line
Diffstat (limited to 'sample-remote-api-call.txt')
-rw-r--r--sample-remote-api-call.txt92
1 files changed, 46 insertions, 46 deletions
diff --git a/sample-remote-api-call.txt b/sample-remote-api-call.txt
index 57e2a89f..de2c1cc9 100644
--- a/sample-remote-api-call.txt
+++ b/sample-remote-api-call.txt
@@ -1,47 +1,47 @@
-<?php
-
-/*
- * YOURLS : sample file showing how to use the API
- * This shows how to tap into your YOURLS install API from *ANOTHER* server
- * not from a file hosted on the same server. It's just a bit dumb to make a
- * remote HTTP request to the server the request originates from.
- *
- * Rename to .php
- *
- */
-
-// EDIT THIS: your auth parameters
-$username = 'joe';
-$password = '123456';
-
-// EDIT THIS: the query parameters
-$url = 'http://planetozh.com/blog/'; // URL to shrink
-$keyword = 'ozh'; // optional keyword
-$format = 'json'; // output format: 'json', 'xml' or 'simple'
-
-// EDIT THIS: the URL of the API file
-$api_url = 'http://yoursite/yourls-api.php';
-
-// Init the CURL session
-$ch = curl_init();
-curl_setopt($ch, CURLOPT_URL, $api_url);
-curl_setopt($ch, CURLOPT_HEADER, 0); // No header in the result
-curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return, do not echo result
-curl_setopt($ch, CURLOPT_POST, 1); // This is a POST request
-curl_setopt($ch, CURLOPT_POSTFIELDS, array( // Data to POST
- 'url' => $url,
- 'keyword' => $keyword,
- 'format' => $format,
- 'action' => 'shorturl',
- 'username' => $username,
- 'password' => $password
- ));
-
-// Fetch and return content
-$data = curl_exec($ch);
-curl_close($ch);
-
-// Do something with the result. Here, we just echo it.
-echo $data;
-
+<?php
+
+/*
+ * YOURLS : sample file showing how to use the API
+ * This shows how to tap into your YOURLS install API from *ANOTHER* server
+ * not from a file hosted on the same server. It's just a bit dumb to make a
+ * remote HTTP request to the server the request originates from.
+ *
+ * Rename to .php
+ *
+ */
+
+// EDIT THIS: your auth parameters
+$username = 'joe';
+$password = '123456';
+
+// EDIT THIS: the query parameters
+$url = 'http://planetozh.com/blog/'; // URL to shrink
+$keyword = 'ozh'; // optional keyword
+$format = 'json'; // output format: 'json', 'xml' or 'simple'
+
+// EDIT THIS: the URL of the API file
+$api_url = 'http://yoursite/yourls-api.php';
+
+// Init the CURL session
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, $api_url);
+curl_setopt($ch, CURLOPT_HEADER, 0); // No header in the result
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return, do not echo result
+curl_setopt($ch, CURLOPT_POST, 1); // This is a POST request
+curl_setopt($ch, CURLOPT_POSTFIELDS, array( // Data to POST
+ 'url' => $url,
+ 'keyword' => $keyword,
+ 'format' => $format,
+ 'action' => 'shorturl',
+ 'username' => $username,
+ 'password' => $password
+ ));
+
+// Fetch and return content
+$data = curl_exec($ch);
+curl_close($ch);
+
+// Do something with the result. Here, we just echo it.
+echo $data;
+
?> \ No newline at end of file