Laravel - Domain API? - laravel

I'm trying to figure something out. I want to make a page where a user can check for domain names and if they're available or not. I'm asking for advice because I don't know where to look. TransIP does have an API but I can't understand their documentation. What can I do? I want to make this work in laravel

There are many API wrappers you can grab from github, here is one I found on a google search. https://github.com/verschoof/transip-api
Just install with composer, put your login and private key in your .env perhaps and then include it in whatever file you want.
$client = new Transip\Client(env('TRANSIP_LOGIN'), env('TRANSIP_KEY'), true);
$domainApi = $client->api('domain');
$domainInfo = $domainApi->getInfo('user-input-domain.com');
$status = $domainApi->checkAvailability();
I would put env variables into a config file and access with config('key') but this is a basic example.

Related

Where do I get the value for `shopOrigin` when using Shopify app bridge?

Throughout the documentation for the new App Bridge, Shopify refers to the shopOrigin value and how it's used to configure the Provider from app-bridge-react but they never specify how to get this value?
The react app is loaded inside of an iframe and the src includes the shopOrigin value as a query string param called shop, but when I try the following code I get the error window is not defined:
const params = queryString.parse(window.location.search);
const config = {
apiKey: process.env.SHOPIFY_API_KEY,
shopOrigin: params.shop,
};
1) Why would I be getting window is not defined in javascript code running in a browser?! This makes no sense to me
2) If this value can be read from of the provided libraries such as #shopufy/app-bridge-react please tell me how
Unless you're using a library tailored specifically to Shopify, you have to manually save the shop origin during OAuth authorization.
Hopefully this Shopify tutorial is of some assistance
The shopOrigin is available within your browser cookies.
If you followed the Shopify development for react and Node.js, you should already saved this after the Shopify authentification.
I am not sure what exactly is the need for shopOrigin, if you just wanted to go to admin section of the shop from client side you can use Redirect in app bridge. otherwise you can store the shop detail on server during auth process and create a get api to retrive the details on client side as needed.

Codeigniter Ion Auth configuration

I am using Ion Auth for registration, and everything is working fine on local, So when I wanted to move Live server I need email activation for new registrations [I am not using SMTP, there is no email config file in my config folder], So I made changes in ion_auth.php in config file as follows::
$config['email_activation'] = TRUE;
$config['manual_activation'] = FALSE;
$config['use_ci_email'] = TRUE;
as far as I know about this library (I am new to CodeIgniter), that's it. But unfortunately these configurations are not taking effect. When I var dump the following items inside constructor of ion_auth.php library file returns null
$this->config->item('use_ci_email','ion_auth') or
$this->config->item('email_activation','ion_auth')
And other config items like 'admin_email' has no issues, I can fetch the value. So, what is wrong with my config file, I am using very basic file provided by the library repo.
When I set the values, inside the constructor of library file as below, it works.
$this->config->set_item('use_ci_email', TRUE);
$this->config->set_item('email_activation', TRUE);
Is there anything wrong I am doing to get this weird behavior.
Ok, so I opened an issue on Ion Auth Git repo, and the Author, Ben Edmunds responded with the solution, If anybody facing this issue, with latest CodeIgniter, please pull the latest commit of IonAuth library and test, It will work.
For more on the issue, please refer the isse,
Codeigniter Ion Auth configuration and Email Activation

Public URL of a document version with versioning S3

I am trying to use the amazon S3 versioning.
So I manage to create a object and display versions and select the version of a well Preci.
But I block or it is for public display url of a document versioning
s3 = Aws::S3::Client.new
prefix = "path/file"
obj = s3.list_object_versions(bucket: 'bucket', prefix: prefix)
I get the version and I want are public url
obj.versions.first
I can not find the method that allows me to have the public URL
Thank you
Per the docs, the version object (ie, what you get upon obj.versions.first) has a version_id key.
You can use that ID to get that version using REST - you just add a versionId=<THE_ID> to your query string.
But I'm not really sure that counts as a public URL. It probably needs you to be authenticated - I don't think it's a good idea to have every version of an object publicly accessible, so probably you just can't.
Thank you for your answer,
Actually my url is not secure, so I used a test url public but that does not work because it says access denied, and yet I added him:
#bucket = Aws::S3::Bucket.new(BUCKET)
url = #bucket.object(name)
url.public_url(acl: 'public-read')
So adding a new permission I manage to not have the access denied but now he told me that the file is not yet well I use the public_url,
I have forgotten something?
#bucket = Aws::S3::Bucket.new(BUCKET)
url = #bucket.object(#name)
url.public_url

Codeigniter FacebookSDK, base_facebook.php library

Hello there I am listing now the base_facebook.php file and can't see in there a function which gives back the username of the user. There is only a function getUser() which returns the user ID. Can you navigate me about the way how to take the username of a user with this FB SDK in codeigniter ?
You would need to make an API call to get the user details:
$me = $facebook->api('/me');
var_dump($me);
Although, the username is not included anymore since v2.0, for privacy reasons.
This is for the old PHP SDK btw, but i assume that is what you are using. The new one works completely different and needs PHP 5.4+. HereĀ“s a tutorial, just in case: http://www.devils-heaven.com/facebook-php-sdk-4-0-tutorial/

Access controllers in sub directory

My controllers are at controllers/frontend directory I access them trough http://localhost/controller_name.
In a routes.php i have that record $route['([a-z_]+)'] = "frontend/$1" and everything works.
But how to change route rule if I want to access http://localhost/controller_name/method/param;
Your rule is sending everything to /frontend/$1 which is a silly idea.
If you have to do that, do this:
$route['(some_controller|other_controller)'] = '$1';
$route['(some_controller|other_controller)/(:any)'] = '$1/$2';
By doing it this way you are essentially destroying CodeIginter automatic routing, as you send EVERYTHING BUT certain controllers to the frontend. To learn how to build a Admin backend properly, try this article:
http://philsturgeon.co.uk/news/2009/07/Create-an-Admin-panel-with-CodeIgniter

Resources