I want to get country wise alexa ranking of a specific website using PHP or JAVASCRIPT.
Can anyone help me?
<?php
$url='google.com.sg';
$xml = simplexml_load_file('http://data.alexa.com/data?cli=10&dat=snbamz&url='.$url);
$rank=isset($xml->SD[1]->POPULARITY)?$xml->SD[1]->POPULARITY->attributes()->TEXT:0;
$country_rank=isset($xml->SD[1]->COUNTRY)?$xml->SD[1]->COUNTRY->attributes()->RANK:0;
$web=(string)$xml->SD[0]->attributes()->HOST;
echo $web." has Alexa Rank ".$rank." and Country Rank ".$country_rank.".\n";
?>
The result will be
google.com.sg has Alexa Rank 282 and Country Rank 2.
Adapted from here
You can use this http://aws.amazon.com/code/AWIS/402
The UrlInfo has a Response Group called RankByCountry that should solve your purpose. Find details here: http://docs.aws.amazon.com/AlexaWebInfoService/latest/
Related
Look at: https://developers.coinbase.com/api/v2#get-currencies
it states clearly "it can be defined as any supported currency". When I query the support currency DKK does not show up... but you can use DKK to get exchange-rate? Also the coinbase website shows my values in DKK.
So, what gives?!?! This is just confusing. I create a list with the support currency, but cannot choose DKK because it does not come in the query?!?!
anyone?
If you query all currencies, DKK is there:
GET https://api.coinbase.com/v2/currencies
RESPONSE {"data":[ ... ,{"id":"DKK","name":"Danish Krone","min_size":"0.01000000"}, ... ]}
You can also query just DKK to compare it with other currencies:
GET https://api.coinbase.com/v2/exchange-rates?currency=DKK
RESPONSE {"data":{"currency":"DKK","rates":{"AED":"0.54780095459776946093168", ... }}}
Hello everyone I want to show some values from the database in a joomla article in the following manner how can I do it ???
I've created the database in the following manner
One way to include php code in your article is to use an extension like
http://extensions.joomla.org/extension/sourcerer
This will allow you to put some php code that will make a query. Doing this in a Joomla way it would look like:
$db = JFactory::getDbo();
$query = $db->getQuery(true)
$query
->select($db->quoteName(array('ques', 'options', 'ans')))
->from($db->quoteName('#__yourtablename'))
->where($db->quoteName('id') . ' = ' . $idOfQuestionYouWantToGrab);
$db->setQuery($query);
$result = $db->loadAssoc();
Now you can show your question:
<?php echo $result['ques']; ?>
then somehow you will need to visualize questions separating them them with some regular expression, since your fields aren't structured well :/
Same with the answers. Then you will need to make some validation with JavaScript to see if answer is the correct one.
I am eager to know how status of Product in Magento get changed/saved?
Requirement-:
Suppose there are existing products which are enabled in Magento...Now If admin Disable particular product from Backend then I need to catch that particular product's Id through code in Magento file system?
So from where Can I get disabled product's id in Magento code? What is the file location & function name for the same? how Can I get that particular id?
Please guide me...
I think the down voting here is a bit unfair. The op is only asking one question - how to get the product id and status of a product after it has been saved.
#Sam - in Magento, instead of finding the exact point in code where a product is being saved, you would typically hook into an event by creating a custom module and use the Magento event/observer facility from within that module.
Have a look through this tutorial which will guide you through the process of creating a module with event/observers: http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/customizing_magento_using_event-observer_method
Specifically related to your question: the event you are looking for is catalog_product_save_after.
The xml for your event would look similar to this:
<events>
<catalog_product_save_after>
<observers>
<yourmodule>
<class>Yourcompany_Yourmodule_Model_Observer</class>
<method>catalog_product_save_after</method>
</yourmodule>
</observers>
</catalog_product_save_after>
</events>
Your observer is going to look similar to this:
class Yourcompany_Yourmodule_Model_Observer
{
public function catalog_product_save_after($observer)
{
$product = $obvserver->getEvent()->getProduct();
$productStatus = $product->getStatus();
$productId = $product->getId();
}
}
Note - code is untested
Im trying to make a front page for a website using cake.
I want to display a random advertisment (adverts listed in advertisements) table. A user has many adverts.
How to i go about doing this with cakephp?
You can randomly retrive your advertisements from mysql
$this->loadModel('Advertisement');
$advertisments = $this->Advertisement->find('all',
'order' => 'rand()');
and use $advertisments as an array in your frontpage.
Just get all Adverts belonging to your user with $data = $this->find('all');
Then use array_rand() to get a random entry out of your $data array.
Further reading:
http://php.net/manual/de/function.array-rand.php
I've spent the last few hours looking at Django Docs and similar questions on here but I'm still unclear on how to tackle the problem...
In essense I want to access the list of email addresses relevent to a certain group, so I can send an email to these customers who are part of this group (named group_one, group_two etc)
class Group(models.Model):
name = models.CharField(primary_key=True)
mailing_list = models.ManyToManyField("Customer", null=True)
class Customer(models.Model):
name = models.CharField()
email = models.EmailField(primary_key=True)
I've tried
group_mail_list = Group.objects.filter(name=group_two)
And this returns an Query Object for group_two but when I try to do a __contains filter I get a error:
TypeError: Related Field has invalid lookup: contains
Anyone help me out? Not sure if it's because it's a many-to-many relationship perhaps?
Thanks in advance :)
What you really want is Customers, then. It seems counter-intuitive on the surface, because you're wanting emails for a Group, but that field is on Customer not Group:
Customer.objects.filter(group__name='group_two').values_list('email')