]> git.mxchange.org Git - friendica.git/commitdiff
Move fetch_url
authorAdam Magness <adam.magness@gmail.com>
Sat, 27 Jan 2018 04:09:48 +0000 (23:09 -0500)
committerAdam Magness <adam.magness@gmail.com>
Sat, 27 Jan 2018 04:09:48 +0000 (23:09 -0500)
move fetch_url function

25 files changed:
include/api.php
include/bbcode.php
include/network.php
mod/dfrn_poll.php
mod/dfrn_request.php
mod/dirfind.php
mod/install.php
mod/nodeinfo.php
mod/oexchange.php
mod/proxy.php
mod/pubsubhubbub.php
spec/dfrn2_contact_request.svg
src/Content/OEmbed.php
src/Core/Worker.php
src/Model/GContact.php
src/Model/Photo.php
src/Model/User.php
src/Object/Image.php
src/Protocol/Diaspora.php
src/Protocol/PortableContact.php
src/Protocol/Salmon.php
src/Util/Network.php
src/Worker/CheckVersion.php
src/Worker/Directory.php
src/Worker/DiscoverPoCo.php

index 8579d2d185b9a6b2c81bbb4a88acb3a4b2160c5a..610cd26ddafad7f2ec29ef534d210a1985fe276c 100644 (file)
@@ -35,6 +35,7 @@ use Friendica\Network\HTTPException\UnauthorizedException;
 use Friendica\Network\HTTPException\TooManyRequestsException;
 use Friendica\Object\Image;
 use Friendica\Protocol\Diaspora;
+use Friendica\Util\Network;
 use Friendica\Util\XML;
 
 require_once 'include/bbcode.php';
@@ -5073,7 +5074,7 @@ function api_get_nick($profile)
                if ($StatusnetHost != $profile) {
                        $StatusnetUser = preg_replace("=https?://(.*)/user/(.*)=ism", "$2", $profile);
                        if ($StatusnetUser != $profile) {
-                               $UserData = fetch_url("http://".$StatusnetHost."/api/users/show.json?user_id=".$StatusnetUser);
+                               $UserData = Network::fetchURL("http://".$StatusnetHost."/api/users/show.json?user_id=".$StatusnetUser);
                                $user = json_decode($UserData);
                                if ($user) {
                                        $nick = $user->screen_name;
index dfaed8ef78233c5df79f07301534ff246c9e1038..0544c4c61665e1f285ee2122bfb56d7e582e5ec7 100644 (file)
@@ -13,6 +13,7 @@ use Friendica\Core\System;
 use Friendica\Core\Config;
 use Friendica\Model\Contact;
 use Friendica\Util\Map;
+use Friendica\Util\Network;
 
 require_once 'include/event.php';
 require_once 'mod/proxy.php';
@@ -688,7 +689,7 @@ function GetProfileUsername($profile, $username, $compact = false, $getnetwork =
                $StatusnetUser = preg_replace("=https?://(.*)/user/(.*)=ism", "$2", $profile);
                if ($StatusnetUser != $profile) {
                        /// @TODO Some hosts run on https, not just http and sometimes http is disabled, let's support both here
-                       $UserData = fetch_url("http://".$StatusnetHost."/api/users/show.json?user_id=".$StatusnetUser);
+                       $UserData = Network::fetchURL("http://".$StatusnetHost."/api/users/show.json?user_id=".$StatusnetUser);
                        $user = json_decode($UserData);
                        if ($user) {
                                if ($getnetwork) {
@@ -749,7 +750,7 @@ function bb_RemovePictureLinks($match) {
                        // if its not a picture then look if its a page that contains a picture link
                        require_once("include/network.php");
 
-                       $body = fetch_url($match[1]);
+                       $body = Network::fetchURL($match[1]);
 
                        $doc = new DOMDocument();
                        @$doc->loadHTML($body);
@@ -806,7 +807,7 @@ function bb_CleanPictureLinksSub($match) {
                        // if its not a picture then look if its a page that contains a picture link
                        require_once("include/network.php");
 
-                       $body = fetch_url($match[1]);
+                       $body = Network::fetchURL($match[1]);
 
                        $doc = new DOMDocument();
                        @$doc->loadHTML($body);
index 7798fd9cd8bac12f1a767ac5998a151a930a4e14..f6a864a635444a275c8b7bd8af6d4ec3f6e3b666 100644 (file)
@@ -57,7 +57,7 @@ function blocked_url($url)
        return Network::blockedURL($url);
 }
 
-function allowedEmail($email)
+function allowed_email($email)
 {
        return Network::allowedEmail($email);
 }
index e5ca96934a20e99cdec7fe71175435575d2f7d0b..7b0785b6f321e58e27fc72e2dbff84593afae239 100644 (file)
@@ -11,6 +11,7 @@ use Friendica\Database\DBM;
 use Friendica\Module\Login;
 use Friendica\Protocol\DFRN;
 use Friendica\Protocol\OStatus;
+use Friendica\Util\Network;
 
 require_once 'include/items.php';
 
@@ -98,7 +99,7 @@ function dfrn_poll_init(App $a)
                );
 
                if (DBM::is_result($r)) {
-                       $s = fetch_url($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');
+                       $s = Network::fetchURL($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');
 
                        logger("dfrn_poll: old profile returns " . $s, LOGGER_DATA);
 
@@ -481,7 +482,7 @@ function dfrn_poll_content(App $a)
                if (($type === 'profile') && (strlen($sec))) {
                        // URL reply
                        if ($dfrn_version < 2.2) {
-                               $s = fetch_url($r[0]['poll']
+                               $s = Network::fetchURL($r[0]['poll']
                                        . '?dfrn_id=' . $encrypted_id
                                        . '&type=profile-check'
                                        . '&dfrn_version=' . DFRN_PROTOCOL_VERSION
index aada465ad26df8fe7058efea0fa710d92f37a5f0..18a6eefaf250ad3d824c6188d219106284bac88c 100644 (file)
@@ -23,6 +23,7 @@ use Friendica\Model\User;
 use Friendica\Model\Profile;
 use Friendica\Module\Login;
 use Friendica\Network\Probe;
+use Friendica\Util\Network;
 
 require_once 'include/enotify.php';
 
@@ -182,7 +183,7 @@ function dfrn_request_post(App $a)
                                }
 
                                if (strlen($dfrn_request) && strlen($confirm_key)) {
-                                       $s = fetch_url($dfrn_request . '?confirm_key=' . $confirm_key);
+                                       $s = Network::fetchURL($dfrn_request . '?confirm_key=' . $confirm_key);
                                }
 
                                // (ignore reply, nothing we can do it failed)
index f1119a297998d1276114a7a6d99369deae69f759..c010aaac92480ee1945923d78bd7851fbcedc292 100644 (file)
@@ -14,6 +14,7 @@ use Friendica\Model\GContact;
 use Friendica\Model\Profile;
 use Friendica\Network\Probe;
 use Friendica\Protocol\PortableContact;
+use Friendica\Util\Network;
 
 require_once 'mod/contacts.php';
 
@@ -177,7 +178,7 @@ function dirfind_content(App $a, $prefix = "") {
                        $p = (($a->pager['page'] != 1) ? '&p=' . $a->pager['page'] : '');
 
                        if(strlen(Config::get('system','directory')))
-                               $x = fetch_url(get_server().'/lsearch?f=' . $p .  '&search=' . urlencode($search));
+                               $x = Network::fetchURL(get_server().'/lsearch?f=' . $p .  '&search=' . urlencode($search));
 
                        $j = json_decode($x);
                }
index cbad3b2548d6cad36ebdd0a9eae7adfe3c79d3e5..ef9f023f52bb1c2f04acfe625f76d0da19321945 100644 (file)
@@ -8,6 +8,7 @@ use Friendica\Core\System;
 use Friendica\Database\DBM;
 use Friendica\Database\DBStructure;
 use Friendica\Object\Image;
+use Friendica\Util\Network;
 
 $install_wizard_pass = 1;
 
@@ -482,10 +483,10 @@ function check_htaccess(&$checks) {
        $status = true;
        $help = "";
        if (function_exists('curl_init')) {
-               $test = fetch_url(System::baseUrl()."/install/testrewrite");
+               $test = Network::fetchURL(System::baseUrl()."/install/testrewrite");
 
                if ($test != "ok") {
-                       $test = fetch_url(normalise_link(System::baseUrl()."/install/testrewrite"));
+                       $test = Network::fetchURL(normalise_link(System::baseUrl()."/install/testrewrite"));
                }
 
                if ($test != "ok") {
index bcaf8e7a931cc590853722580b6dbc31a31a4092..d0c4acab02b3a1ddb23470f0df1860159e76f36f 100644 (file)
@@ -9,6 +9,7 @@ use Friendica\App;
 use Friendica\Core\Addon;
 use Friendica\Core\System;
 use Friendica\Core\Config;
+use Friendica\Util\Network;
 
 function nodeinfo_wellknown(App $a) {
        $nodeinfo = ['links' => [['rel' => 'http://nodeinfo.diaspora.software/ns/schema/1.0',
@@ -246,7 +247,7 @@ function nodeinfo_cron() {
        // Now trying to register
        $url = 'http://the-federation.info/register/'.$a->get_hostname();
         logger('registering url: '.$url, LOGGER_DEBUG);
-       $ret = fetch_url($url);
+       $ret = Network::fetchURL($url);
         logger('registering answer: '.$ret, LOGGER_DEBUG);
 
         logger('cron_end');
index 902499c031e9e5c44b2fd1cdbcc86e66b57f4714..79414a7f6a727f010edd7bb743369d8ccb2f8565 100644 (file)
@@ -6,6 +6,7 @@ use Friendica\App;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
 use Friendica\Module\Login;
+use Friendica\Util\Network;
 
 function oexchange_init(App $a) {
 
@@ -39,7 +40,7 @@ function oexchange_content(App $a) {
        $tags = (((x($_REQUEST,'tags')) && strlen($_REQUEST['tags']))
                ? '&tags=' . urlencode(notags(trim($_REQUEST['tags']))) : '');
 
-       $s = fetch_url(System::baseUrl() . '/parse_url?f=&url=' . $url . $title . $description . $tags);
+       $s = Network::fetchURL(System::baseUrl() . '/parse_url?f=&url=' . $url . $title . $description . $tags);
 
        if (! strlen($s)) {
                return;
index 538275ef00f9e1a84c293e97156418b71b31a02d..1497185917f1ea189195fbbf9dfb30289346d84d 100644 (file)
@@ -10,6 +10,7 @@ use Friendica\Core\System;
 use Friendica\Database\DBM;
 use Friendica\Model\Photo;
 use Friendica\Object\Image;
+use Friendica\Util\Network;
 
 define('PROXY_DEFAULT_TIME', 86400); // 1 Day
 
@@ -161,7 +162,7 @@ function proxy_init(App $a) {
                // It shouldn't happen but it does - spaces in URL
                $_REQUEST['url'] = str_replace(' ', '+', $_REQUEST['url']);
                $redirects = 0;
-               $img_str = fetch_url($_REQUEST['url'], true, $redirects, 10);
+               $img_str = Network::fetchURL($_REQUEST['url'], true, $redirects, 10);
 
                $tempfile = tempnam(get_temppath(), 'cache');
                file_put_contents($tempfile, $img_str);
index f3134308fb9fff24c1783fc0774df09a9a8e9168..c2091d4de84df0c643801ad2f336ec46138eda96 100644 (file)
@@ -3,6 +3,7 @@
 use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Database\DBM;
+use Friendica\Util\Network;
 
 function post_var($name) {
        return (x($_POST, $name)) ? notags(trim($_POST[$name])) : '';
@@ -109,7 +110,7 @@ function pubsubhubbub_init(App $a) {
                // we don't actually enforce the lease time because GNU
                // Social/StatusNet doesn't honour it (yet)
 
-               $body = fetch_url($hub_callback . "?" . $params);
+               $body = Network::fetchURL($hub_callback . "?" . $params);
                $ret = $a->get_curl_code();
 
                // give up if the HTTP return code wasn't a success (2xx)
index e85eaf20b51f811c961552a1a9b86e84ca1686a2..23b040985f0fca23fbd5724bec608811e65171cf 100644 (file)
@@ -93,9 +93,9 @@ text { font:12px Dialog; }
 <text x="149" y="2112" style="font:13px Open Sans">- create a contact for Karen in the contact table with </text>
 <text x="149" y="2135" style="font:13px Open Sans">the scraped data with blocked = 1 and pending = 1 </text>
 <text x="149" y="2158" style="font:13px Open Sans">(Karens pubkey becomes the contact site-pubkey)</text>
-<text x="149" y="2204" style="font:13px Open Sans">- fetch_url($dfrn_request . '?confirm_key=' . </text>
+<text x="149" y="2204" style="font:13px Open Sans">- Network::fetchURL($dfrn_request . '?confirm_key=' . </text>
 <text x="149" y="2227" style="font:13px Open Sans">$confirm_key);</text>
-<text x="149" y="2273" style="font:13px Open Sans">- fetch_url(http://karenhomepage.com/dfrn_request?</text>
+<text x="149" y="2273" style="font:13px Open Sans">- Network::fetchURL(http://karenhomepage.com/dfrn_request?</text>
 <text x="149" y="2296" style="font:13px Open Sans">confirm_key=”ABC123”)</text>
 <clipPath id="clip13"><path d="M1061,2027 L1238,2027 L1238,2069 L1061,2069 L1061,2027 Z" /></clipPath>
 <path d="M1070,2028 C1065.5820313,2028 1062,2031.5820313 1062,2036 L1062,2059 C1062,2063.4179688 1065.5820313,2067 1070,2067 L1228,2067 C1232.4179688,2067 1236,2063.4179688 1236,2059 L1236,2036 C1236,2031.5820313 1232.4179688,2028 1228,2028 Z" style="fill:rgb(127,127,127);stroke:none" clip-path="url(#clip13)" />
index 9f1df5174566bdca08e5be7493ad5d70fcb35c22..80fab8c647a5d320b32eb9bc432d31a3b3f2ac41 100644 (file)
@@ -10,6 +10,7 @@ use Friendica\Core\L10n;
 use Friendica\Core\System;
 use Friendica\Core\Config;
 use Friendica\Database\DBM;
+use Friendica\Util\Network;
 use Friendica\Util\ParseUrl;
 use dba;
 use DOMDocument;
@@ -77,7 +78,7 @@ class OEmbed
                        if (!in_array($ext, $noexts)) {
                                // try oembed autodiscovery
                                $redirects = 0;
-                               $html_text = fetch_url($embedurl, false, $redirects, 15, "text/*");
+                               $html_text = Network::fetchURL($embedurl, false, $redirects, 15, "text/*");
                                if ($html_text) {
                                        $dom = @DOMDocument::loadHTML($html_text);
                                        if ($dom) {
@@ -85,13 +86,13 @@ class OEmbed
                                                $entries = $xpath->query("//link[@type='application/json+oembed']");
                                                foreach ($entries as $e) {
                                                        $href = $e->getAttributeNode("href")->nodeValue;
-                                                       $txt = fetch_url($href . '&maxwidth=' . $a->videowidth);
+                                                       $txt = Network::fetchURL($href . '&maxwidth=' . $a->videowidth);
                                                        break;
                                                }
                                                $entries = $xpath->query("//link[@type='text/json+oembed']");
                                                foreach ($entries as $e) {
                                                        $href = $e->getAttributeNode("href")->nodeValue;
-                                                       $txt = fetch_url($href . '&maxwidth=' . $a->videowidth);
+                                                       $txt = Network::fetchURL($href . '&maxwidth=' . $a->videowidth);
                                                        break;
                                                }
                                        }
index 893b1bccc8877a305bb5accebb884dfa64a02100..11146e4a215f782328439fdb5de99b7f7ebf2a76 100644 (file)
@@ -10,7 +10,7 @@ use Friendica\Core\System;
 use Friendica\Database\DBM;
 use Friendica\Model\Process;
 use Friendica\Util\Lock;
-
+use Friendica\Util\Network;
 use dba;
 
 require_once 'include/dba.php';
@@ -888,7 +888,7 @@ class Worker
                }
 
                $url = System::baseUrl()."/worker";
-               fetch_url($url, false, $redirects, 1);
+               Network::fetchURL($url, false, $redirects, 1);
        }
 
        /**
index d125ff8fe24267ff2b16d7430432c9bddbc46740..28c872f32c195ed872ff593c78cc863875eaa7dd 100644 (file)
@@ -13,6 +13,7 @@ use Friendica\Model\Contact;
 use Friendica\Model\Profile;
 use Friendica\Network\Probe;
 use Friendica\Protocol\PortableContact;
+use Friendica\Util\Network;
 use dba;
 use Exception;
 
@@ -568,7 +569,7 @@ class GContact
                $done[] = System::baseUrl() . '/poco';
 
                if (strlen(Config::get('system', 'directory'))) {
-                       $x = fetch_url(get_server()."/pubsites");
+                       $x = Network::fetchURL(get_server()."/pubsites");
                        if ($x) {
                                $j = json_decode($x);
                                if ($j->entries) {
index 94d5581bf0b0ad30f1a9c3c3db9bdf3aa4859a50..23d893c9251092777faadb5b7f4a10a44682b4d5 100644 (file)
@@ -12,6 +12,7 @@ use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Database\DBM;
 use Friendica\Object\Image;
+use Friendica\Util\Network;
 use dba;
 
 require_once 'include/dba.php';
@@ -101,7 +102,7 @@ class Photo
                $photo_failure = false;
 
                $filename = basename($image_url);
-               $img_str = fetch_url($image_url, true);
+               $img_str = Network::fetchURL($image_url, true);
 
                if ($quit_on_error && ($img_str == "")) {
                        return false;
index 07df7ca6150a35171be1cafa3335fd3a381bd64c..ecd1040b7562b69435842e8d66cbe538889a805d 100644 (file)
@@ -17,6 +17,7 @@ use Friendica\Model\Group;
 use Friendica\Model\Photo;
 use Friendica\Object\Image;
 use Friendica\Util\Crypto;
+use Friendica\Util\Network;
 use dba;
 use Exception;
 
@@ -468,7 +469,7 @@ class User
                        $photo_failure = false;
 
                        $filename = basename($photo);
-                       $img_str = fetch_url($photo, true);
+                       $img_str = Network::fetchURL($photo, true);
                        // guess mimetype from headers or filename
                        $type = Image::guessType($photo, true);
 
index 2feb3b92411e1fc8223244be2f4e7db5fce7d81a..84c462205e28e82d10cbf6dc1285b1ba1c634967 100644 (file)
@@ -12,6 +12,7 @@ use Friendica\Core\L10n;
 use Friendica\Core\System;
 use Friendica\Database\DBM;
 use Friendica\Model\Photo;
+use Friendica\Util\Network;
 use Exception;
 use Imagick;
 use ImagickPixel;
@@ -773,7 +774,7 @@ class Image
                $data = Cache::get($url);
 
                if (is_null($data) || !$data || !is_array($data)) {
-                       $img_str = fetch_url($url, true, $redirects, 4);
+                       $img_str = Network::fetchURL($url, true, $redirects, 4);
                        $filesize = strlen($img_str);
 
                        if (function_exists("getimagesizefromstring")) {
index 540f82cc639347e3a8ac5c6254a9a05df2ea1f71..14bad8e1d93cb57c52b0371ee2454552e1b150b0 100644 (file)
@@ -25,8 +25,8 @@ use Friendica\Model\Queue;
 use Friendica\Model\User;
 use Friendica\Network\Probe;
 use Friendica\Util\Crypto;
+use Friendica\Util\Network;
 use Friendica\Util\XML;
-
 use dba;
 use SimpleXMLElement;
 
@@ -1257,7 +1257,7 @@ class Diaspora
 
                logger("Fetch post from ".$source_url, LOGGER_DEBUG);
 
-               $envelope = fetch_url($source_url);
+               $envelope = Network::fetchURL($source_url);
                if ($envelope) {
                        logger("Envelope was fetched.", LOGGER_DEBUG);
                        $x = self::verifyMagicEnvelope($envelope);
@@ -1275,7 +1275,7 @@ class Diaspora
                        $source_url = $server."/p/".urlencode($guid).".xml";
                        logger("Fetch post from ".$source_url, LOGGER_DEBUG);
 
-                       $x = fetch_url($source_url);
+                       $x = Network::fetchURL($source_url);
                        if (!$x) {
                                return false;
                        }
index 22615fee10663d18540747cf94307504b6f732e3..65e71d07a9ca4536ad68a3431e6b7b0fe6346413 100644 (file)
@@ -15,6 +15,7 @@ use Friendica\Database\DBM;
 use Friendica\Model\GContact;
 use Friendica\Model\Profile;
 use Friendica\Network\Probe;
+use Friendica\Util\Network;
 use dba;
 use DOMDocument;
 use DOMXPath;
@@ -85,7 +86,7 @@ class PortableContact
 
                logger('load: ' . $url, LOGGER_DEBUG);
 
-               $s = fetch_url($url);
+               $s = Network::fetchURL($url);
 
                logger('load: returns ' . $s, LOGGER_DATA);
 
index 5b0c66fb9d13271fba3bc392d693e0912d92cd4f..3e8d3681693c002852d7d9402d1566048b366718 100644 (file)
@@ -6,6 +6,7 @@ namespace Friendica\Protocol;
 
 use Friendica\Network\Probe;
 use Friendica\Util\Crypto;
+use Friendica\Util\Network;
 use Friendica\Util\XML;
 
 /**
@@ -50,7 +51,7 @@ class Salmon
                                                $ret[$x] = substr($ret[$x], 5);
                                        }
                                } elseif (normalise_link($ret[$x]) == 'http://') {
-                                       $ret[$x] = fetch_url($ret[$x]);
+                                       $ret[$x] = Network::fetchURL($ret[$x]);
                                }
                        }
                }
index f25d9c9a265981bac26d1e6d86be986dd26dfbc7..39f2e03511f939518922230dcadc823460c1f1ea 100644 (file)
@@ -714,7 +714,7 @@ class Network
                                } else {
                                        $scaled = $mtch[1];
                                }
-                               $i = fetch_url($scaled);
+                               $i = self::fetchURL($scaled);
                                if (! $i) {
                                        return $srctext;
                                }
index b7e99cb67ec201b9ecc0b72a350abb94c77c3037..2e089502f16c49e7bf75beae9ba548b57e40a546 100644 (file)
@@ -8,6 +8,7 @@
 namespace Friendica\Worker;
 
 use Friendica\Core\Config;
+use Friendica\Util\Network;
 
 /**
  * @brief check the git repository VERSION file and save the version to the DB
@@ -37,7 +38,7 @@ class CheckVersion {
                logger("Checking VERSION from: ".$checked_url, LOGGER_DEBUG);
 
                // fetch the VERSION file
-               $gitversion = dbesc(trim(fetch_url($checked_url)));
+               $gitversion = dbesc(trim(Network::fetchURL($checked_url)));
                logger("Upstream VERSION is: ".$gitversion, LOGGER_DEBUG);
 
                Config::set('system', 'git_friendica_version', $gitversion);
index e38f9eeeee46a89cabace54a8bc0fc1757193274..634c5a5ec513479a9bce8066dcd7967e4e15e703 100644 (file)
@@ -10,6 +10,7 @@ use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
+use Friendica\Util\Network;
 
 class Directory {
        public static function execute($url = '') {
@@ -32,7 +33,7 @@ class Directory {
 
                logger('Updating directory: ' . $arr['url'], LOGGER_DEBUG);
                if (strlen($arr['url'])) {
-                       fetch_url($dir . '?url=' . bin2hex($arr['url']));
+                       Network::fetchURL($dir . '?url=' . bin2hex($arr['url']));
                }
 
                return;
index c00db89ff518f33b37559ac2d514c4a703a5e3b5..d72579cfb50524239831dc33701c014e963fa4f7 100644 (file)
@@ -11,6 +11,7 @@ use Friendica\Database\DBM;
 use Friendica\Model\GContact;
 use Friendica\Network\Probe;
 use Friendica\Protocol\PortableContact;
+use Friendica\Util\Network;
 
 require_once 'include/datetime.php';
 
@@ -217,7 +218,7 @@ class DiscoverPoCo {
                        }
                }
 
-               $x = fetch_url(get_server()."/lsearch?p=1&n=500&search=".urlencode($search));
+               $x = Network::fetchURL(get_server()."/lsearch?p=1&n=500&search=".urlencode($search));
                $j = json_decode($x);
 
                if (count($j->results)) {