У меня проблема с The Best API при запуске этого на моем сервере, я получаю эту ошибку
Тайм-аут запроса
Этот запрос занимает слишком много времени для обработки, он задержан сервером. Если время не истекло, обратитесь к администратору данного веб-сайта, чтобы увеличить «Время ожидания подключения».
Даже я использую это set_time_limit (0);
и Spinner не возвращает никакого закрученного контента.
Вот что я использую:
<?php
function curl_post($url, $data, &$info){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, curl_postData($data));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, $url);
$html = trim(curl_exec($ch));
curl_close($ch);
return $html;
}
function curl_postData($data){
$fdata = "";
foreach($data as $key => $val){
$fdata .= "$key=" . urlencode($val) . "&";
}
return $fdata;
}
set_time_limit(0);
$url = 'http://thebestspinner.com/api.php';
#$testmethod = 'identifySynonyms';
$testmethod = 'replaceEveryonesFavorites';
# Build the data array for authenticating.
$data = array();
$data['action'] = 'authenticate';
$data['format'] = 'php'; # You can also specify 'xml' as the format.
# The user credentials should change for each UAW user with a TBS account.
$data['username'] = '[email protected]';
$data['password'] = 'password';
# Authenticate and get back the session id.
# You only need to authenticate once per session.
# A session is good for 24 hours.
$output = unserialize(curl_post($url, $data, $info));
if($output['success']=='true'){
# Success.
$session = $output['session'];
# Build the data array for the example.
$data = array();
$data['session'] = $session;
$data['format'] = 'php'; # You can also specify 'xml' as the format.
$data['text'] = '<p>Google today reminded everyone just how far it has come by not just releasing a video that shows off what the company has accomplished over the years since its inception, but also redesigning its logo so that it looks altogether more flat, presumably to follow suit with how interfaces and logos seem to look in 2015. The video, by the way, is well worth a watch if you find yourself forgetting just what Google has contributed to the world of search and information technology. You may be frightened of the information it holds, but there’s no doubting Google’s technical prowess.</p> <p>If you’re using an Android smartphone and want to celebrate the evolution of Google, then you might want to check out this customized boot animation that has cropped up on <em>Android Forums</em>. Installing it is a relatively simple affair, and we’re going to take you through it step by step. There are a number of ways to go about installing it; we’ve picked the simplest one that applies to most devices.</p> <p><img width="600" height="320" alt="Google-Evolved-logo-bootanimation-Android" src="http://cdn.redmondpie.com/wp-content/uploads/2015/09/Google-Evolved-logo-bootanimation-Android.jpg" style="margin: 0px auto; display: block;" class="aligncenter size-full wp-image-194470" scale="0"></p> <p>Here’s what you need to do get the ‘Google Evolved’ boot animation onto your device:</p> <p>Step 1: Install a root file explorer to your phone if you don’t already have one. Free options like ES File Explorer can be downloaded from the Play Store.</p> <p>Step 2: Launch the file explorer app and navigate to the <i>/system/media </i>directory. Copy the ‘bootanimation.zip’ file inside and paste it to another folder. This is optional, but it’s always worth having a backup just in case the worst was to happen.</p> <p>Step 3: Download the ‘Google Evolved’ bootanimation.zip to your phone from here.</p> <p>Step 4: Copy the downloaded file from the Downloads folder, paste it to <i>/system/media</i>, allowing the file explorer to overwrite the existing file. Remember, this directory isn’t the same for all devices. You might have to look up where your device’s bootanimation directory is.</p> <p>Step 5: Once the file is copied over, make sure that its permissions are set to 0644. Note that copying to root directories requires root access. If your device isn’t rooted, and you have the Android SDK set up on your computer, you can use ADB to push the bootanimation.zip file from your computer to the <em>/data/local </em>directory.</p> <p>Step 6: Reboot your device and you’re set!</p> <p><img width="599" height="322" alt="Ikbdtml" src="http://cdn.redmondpie.com/wp-content/uploads/2015/09/Ikbdtml.gif" style="margin: 0px auto; display: block;" class="aligncenter wp-image-194471" scale="0"></p> <p>The other two ways to get the boot animation involve flashing a ZIP file using a custom recovery like ClockworkMod or TWRP and installing an APK file via the CyanogenMod Theme Engine. The latter is the easiest method of the lot, but you will need to have CyanogenMod installed, or any other AOSP custom ROM that includes the aforementioned theme engine.</p> <p><em>(via: Reddit)</em></p> <p>You may also like to check out:</p> <ul> <li>Download Android 6.0 Marshmallow Launcher, Wallpapers, Boot Animation For Any Device</li> </ul> <p>You can follow us on Twitter, add us to your circle on Google+ or like our Facebook page to keep yourself updated on all the latest from Microsoft, Google, Apple and the web.</p> </div>';
$data['action'] = $testmethod;
$data['maxsyns'] = '3'; # The number of synonyms per term.
if($testmethod=='replaceEveryonesFavorites'){
# Add a quality score for this method.
$data['quality'] = '1';
}
# Post to API and get back results.
$output = curl_post($url, $data, $info);
$output = unserialize($output);
# Show results.
echo "<p><b>Method:</b><br>$testmethod</p>";
echo "<p><b>Text:</b><br>$data[text]</p>";
$data['action'] = 'apiQuota';
$quota = curl_post($url, $data, $info);
$quota = unserialize($quota);
if($output['success']=='true'){
echo "<p><b>Output:</b><br>" . str_replace("\r", "<br>", $output['output']) . "</p><p>Remaining quota: $quota[output]</p>";
}
else{
echo "<p><b>Error:</b><br>$output[error]</p>";
}
}
else{
# There were errors.
echo "<p><b>Error:</b><br>$output[error]</p>";
}
?>
Вот URL, где мой код там
http://technews4u.net/apiexample.php
Задача ещё не решена.
Других решений пока нет …