pinterest sharing not working with AngularJS and laravel framework - php

When I am using any code related with php + AngularJS then its not able to share anything on pinterest direct from our application.
Like:
$pinterest = new PinterestAPI('487992287213444318092', '3e49484c42b9a43716b6306c43083aaed2860a879d5f6ef112c01e1');
$loginurl = $pinterest->auth->getLoginUrl('http://localhost:3000', array('read_public, write_public, read_relationships,write_relationships'), 'code');
Any code structure like:
https://github.com/sahat/satellizer/blob/master/examples/server/php/app/Http/Controllers/AuthController.php
this code structure working fine with others sharing.

Please note that you are only able to share public available URLs. You are not able to share local URLs. You need to know that the pinteres API is crawling your ShareUrl. This is not possible on your local environment because the web crawler could not access it.
The PDF.pin syntax is the following. It does work with public web URLs.
PDK.pin( ImageUrl, Description, ShareUrl, function(){
// Do whatever you like
});

Related

Accessing data from external websites to 'create' own application of that data

Wow, i hope i have written the title in a correct way, because i really have no idea how this is called.
Let me explain what i am looking for.
I have a simple application. And it contains the following:
- Frontpage (salespage)
- Admin area
- Member area
- Database to provide the app of data
I have hosted the basics of this application on a server, let's call it 'www.the.app'. And i have written it in PHP using Laravel.
Now i want to use the functions of the app, which is hosted on www.the.app and use the functions like the admin area, member area, the frontpage and create my own database on 'www.awesome.app'.
What would be the best way to make such a thing happen?
I am not looking for direct solutions. I am just looking for information to point me in the right direction to be able to make the above reality. Anything would be apreciated, like information, a name i can search on, what ever is related to this.
And if there is any more information needed, let me know please :)
Here is exactly how you can do it :
1) To Auto Login To The Site :
Note : As you will need to probably get data from login based site so you can auto login to the site through using CURL while using User Credentials with it.
To Learn How To Login Through CURL.Take A Look At :
Using PHP & Curl to login to my websites form
2) Extracting Data After Logging In Through CURL :
Note : After logging to the site now you will need to use PHP DOM to extract data from the site.So you can extract data something like this way by using PHP Simple HTML DOM Parser Library.
PHP Simple HTML DOM Parser :
LINK : http://simplehtmldom.sourceforge.net/
Sample Code For Downloading All Images From A Link :
Note : Following code will download all the images present at the URL given in the code.
<?php
// Make sure to include the library php file
include('simple_html_dom.php');
//URL To Download Images From
$url = "http://www.facebook.com/"
// Create DOM from URL or file
$html = file_get_html($url);
// Find all images
$i=1;
foreach($html->find('img') as $element) {
$url = $element->src;
$img = "/my_folder/image_".$i.".png";
file_put_contents($img, file_get_contents($url));
$i++;
}
?>

How to change URLs in a Site developed using Laravel?

I have a website being developed using Laravel 4 by a freelance dev. While the developer has developed the site with some standard URL's for each page, I want to be able to change the words in URL to suite each of my target markets.
For example, developer made URL of one page: www.site.com/public/city/vehicles
Later, i want to be able to change to www.site.com/Rome/Cars or www.site.com/Sydney/bikes
However the developer says it wont be possible later on to change URLs as this is limitation in Laravel. Can anyone please shed some light on this and how to do this?
Why it is not possible ?? URL can me made dynamic if you want . Using route as
Route::get('/city/{slug}/{slug}',array('as'=>'city.vehciles','uses'=>'yourcontroller#yourmethod'));
This will output :
www.site.com/city/Rome/Cars
//if public folder is removed from url .
//Here `Rome` and `cars` are dynamic and the value comes as per the slug value from database.
In the above route slug are the thing that can me made dynamic . Just keep some place to add slug while adding vehicle in your dashboard from where you add vehicles.
Also, if you want to explore more then please see this doc .
Hope you get it .
You can remove "/public/" from your Laravel 4 website path by editing your Apache2 configuration files.
This file can be in different places (depending on your server setup), but it should be easily findable. E.g. for AWS EC2 (Ubuntu 14.04) it's /etc/apache2/sites-available/000-default.conf
You want to place this snippet within that configuration file:
DocumentRoot /var/www/YOUR_PATH/public
<Directory "/var/www/YOUR_PATH/public">
AllowOverride ALL
</Directory>
Remember to call service apache2 restart so your server recognizes and serves this update.
Also, depending on how your developer built your website, you might need to update your Laravel routing file too.
For reference it should look something like this (app/Http/routes.php):
Route::get('ajax/support/{city}/{vehicle}', 'MyController#MyMethod');
Then you'd have a matching method like so (app/Http/Controllers/MyController.php):
class MyController extends Controller
{
public function MyMethod(Request $request, $city, $vehicle)
{
// You can access $city and $vehicle here.
}
}

Deep linking an app in PHP is not working

I have a webpage that needs to check to see if an app exists using a deep link, but it doesn't seem to work like it should. I have tried the following things.
Using a redirect in PHP (Doesn't work)
header('Location: exampleapp://param=test');
Using a redirect using JavaScript (Doesn't work)
var appurl = 'exampleapp://param=test';
var appstore = 'https://itunes.apple.com/us/app/...';
var timeout;
function preventPopup() {
clearTimeout(timeout);
timeout = null;
window.removeEventListener('pagehide', preventPopup);
}
function startApp() {
window.location = appurl;
timeout = setTimeout(function(){
if(confirm('You do not seem to have the App installed, do you want to go download it now?')){
document.location = appstore;
}
}, 100);
window.addEventListener('pagehide', preventPopup);
}
// app start is then called in the onload
Same as above but replace the the line window.location = appurl; with document.getElementById('deeplink').click(); and adding a link in the html's webpage. (Works) <a id="deeplink" href="exampleapp://param=test">Deep Link</a>
Is there a reason why you can't redirect using a header in PHP?
The PHP version doesn't work, because of the way HTTP works. The HTTP protocol doesn't specify that it should work to redirect to a different protocol from within the "Location:" header. There is nothing specific to PHP here, it's a HTTP issue.
The Javascript version doesn't work because you wanted to set the windows location. And the window cannot show the contents of "exampleapp://..." . You want the link to open like when the user clicks on it. Instead of using window.location you may use document.location.href. That should work.
Another problem:
in your code you write exampleapp:// in 1) and 2). And in 3) you write testapp:// - make sure you use the same URL in all three cases, so that you can be sure that the URL can work eventually..
The answer is to use Apples implementation called 'Smart Banners'
<meta name="apple-itunes-app" content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL">
You can include three comma-separated parameters in the content
attribute:
app-id: (Required.) Your app's unique identifier. To find your app ID
from the iTunes Link Maker, type the name of your app in the Search
field, and select the appropriate country and media type. In the
results, find your app and select iPhone App Link in the column on the
right. Your app ID is the nine-digit number in between id and ?mt.
affiliate-data: (Optional.) Your iTunes affiliate string, if you are
an iTunes affiliate. If you are not, find out more about becoming an
iTunes affiliate at http://www.apple.com/itunes/affiliates/.
app-argument: (Optional.) A URL that provides context to your native
app. If you include this, and the user has your app installed, she can
jump from your website to the corresponding position in your iOS app.
Typically, it is beneficial to retain navigational context because: If
the user is deep within the navigational hierarchy of your website,
you can pass the document’s entire URL, and then parse it in your app
to reroute her to the correct location in your app. If the user
performs a search on your website, you can pass the query string so
that she can seamlessly continue the search in your app without having
to retype her query. If the user is in the midst of creating content,
you can pass the session ID to download the web session state in your
app so she can nondestructively resume her work. You can generate the
app-argument of each page dynamically with a server-side script. You
can format it however you'd like, as long as it is a valid URL.
https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/PromotingAppswithAppBanners/PromotingAppswithAppBanners.html

Integrate Disqus comments with Android

I am trying to integrate Disqus comments to my Android application, and I am following this tutorial:
http://globeotter.com/blog/disqus-android-code/
I didn't understand well part about disqus_identifier. As you can see from the code below I use this code to acces showcomments.php on my server.
webDisqus.loadUrl("http://balkanandroid.com/showcomments.php?disqus_id="+identifer);
Where identifer is part of url behind top level domain name, something like this:
http://balkanandroid.com/graficka-evolucija-nexus-telefona/
And I use /graficka-evolucija-nexus-telefona/ as disqus identifer.
And I get this error message:
We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
Here is server side php code>
Based on the example code provided, this is a pretty easy fix. Just change this line:
var disqus_shortname = '<balkanandroid>';
to this:
var disqus_shortname = 'balkanandroid';

cpanel XML API 404 error

Had a look at quite a few posts on stack and the cpanel forum but still cant seem to find a solution.
Im trying to retreive information via an api call but it just always seems to fail. I know its to do with the url 404'ing but not sure how to fix.
I am using the the XMl API class:
https://github.com/CpanelInc/xmlapi-php/
The code I have is:
$this->load->library('xmlapi');
$xmlapi = new xmlapi(XMLAPI_HOST);
$xmlapi->password_auth(CPANEL_USER, CPANEL_PASSWORD);
$xmlapi->set_debug(1);
echo '<pre>';
print_r($xmlapi->accountsummary(CPANEL_USER));
echo '</pre>';
The above outputs the xml array. In the error_notice it says:
HTTP error 404, The requested page was not found.
Thats fine. So I echo out the url it uses which 404's:
http://mysite.co.uk:2082/xml-api/accountsummary
The cpanel docs are a little awkward to navigate but just cant find anything on the actual url structure, besides its the class that compiles the url. ive tried adding www, tried an ip etc but no idea why its erroring.
Also if it helps im accessing a normal cpanel account, not a WHM admin and its through http.
Thanks for reading, any help guidance on getting it working would be appreciated.
The issue you are experiencing is that you are attempting to use the accountsummary function from cPanel ports (2082/2083). The accountsummary function is limited to the administrator accounts since this function is designed to provide administrative api level access for pulling account information from any user on the server.
To access the accountsummary api, you will need to call the accountsummary api from the following url:
https://$SERVER_IP:2087/xml-api/accountsummary?user=$USERNAME
You will need to replace $SERVER_IP and $USERNAME with their respective values.
http://docs.cpanel.net/twiki/bin/view/SoftwareDevelopmentKit/ShowAccountInformation

Categories