Tag Archives: rest

Creating a new customer in Magento(RESTful,PHP)

Questions: I am trying to create a new customer in Magento. Here’s PHP script I wrote for that <?php $callbackUrl = “http://localhost/magento/webservices/NewCustomer1.php”; $temporaryCredentialsRequestUrl = “http://localhost/magento/oauth/initiate?oauth_callback=”. urlencode($callbackUrl); $adminAuthorizationUrl = ‘http://localhost/magento/admin/oauth_authorize’; $accessTokenRequestUrl = ‘http://localhost/magento/oauth/token’; $apiUrl = ‘http://localhost/magento/api/rest’; $consumerKey = ‘s3xt7w8lwhfrrfzrfvwm3lrilkf66d5n’; $consumerSecret = ‘vr3eq1x899pz1cf4zzxjzx3q03t66r3n’; session_start(); if (!isset($_GET[‘oauth_token’]) && isset($_SESSION[‘state’]) && $_SESSION[‘state’] == 1) { $_SESSION[‘state’] = 0; }… Read More »

CodeIgniter RESTful, async / background process

Questions: I’m using codeIgniter RESTful API (https://github.com/philsturgeon/codeigniter-restserver) that return information (json format) to my android/iphone app. There are an operation where i send some values, if it is everything OK i return 200 code as response. Now, i want to add a new operation at the same method: send notifications of this modifications with APNS… Read More »

WooCommerce REST API request returns error

Questions: I’m developing a shopping cart Site and an App. I want to get product details from DB for my App, So I have recently used JSON REST API (WP API), And also latest version of WooCommerce 2.1. When I run my url http://ishop/wc-api/v1/ I get a long json output, So I can make sure… Read More »

enabling cors in codeigniter ( restserver by @chriskacerguis )

Questions: http.get request in agularJs controller works fine when my client app and api are in localhost. when api is moved to server., issue arised. client side using angularJs $http.get(‘http://domain.com/api/spots/2/0’).success(function(datas){ console.log(datas); }); log gives: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://domain.com/api/spots/2/0. This can be fixed by moving the… Read More »

How to find nearest day of week in php?

Questions: How to find a speciefic nearest day of the week in PHP if initially I have a date string like: 07.05.2010? For example, I want to find the nearest Sunday (or any day of the week). How can I implement this? Thanks Answers:

php restrict access to files in directory

Questions: I am trying to restrict direct access to files in a directory. So for example i have website.com/files/example.flv. So if users go straight to the file in the URL, i want them to be redirected to the home page. I have tried the following using htaccess deny from all but its not working great.… Read More »

How to clear php's gettext cache without restart Apache nor change domain?

Questions: This is a little code snippet from php manual: putenv(‘LC_ALL=zh_CN’); setlocale(LC_ALL, ‘zh_CN’); bindtextdomain(‘domain’, ‘./locale’); textdomain(‘domain’); echo gettext(‘Hello’); Which will output 你好 as defined in domain.mo file, but the problem is as long as the Apache is running, gettext() always return the cached result. If I change the translation of Hello to 您好 in domain.mo,… Read More »