I've been trying to access Google Maps web services or even Yahoo Maps using PHP. When I run it, I get nothing. All the HTML and prints come out but absolutely nothing from Google service.
When I gave the code to my friend to run it on his local PC, it showed up fine and was working showing the map. But it seems I have trouble here at university.
Is it because I am behind a proxy? What could be the issue? Also the host can't be accessed outside the university.
Is there any solution to this?
If it is getting stuck on simplexml_load_file, and you are trying to use simplexml_load_file to get a remote file, and your University (like mine) has PHP in safe mode, this will fail. You can't get remote files like that in safe-mode. You should get the XML via cURL, and then use simplexml_load_string.
This would also explain why your friend could do it and you couldn't.
Related
I try to get my Lotus Notes calendar entries via PHP.
I read about the REST API, but when I tried to access my calendar there is an forbidden error and it seems that to access the content, there must be some settings on the Lotus Notes Server (I cannot make this as the servers are hold by external admins)
I know that I cann access the entries via vba, like the guy in this thread made. For this I only need the mail database .nsf and the server (for me it works with just "")
I'm sure that there must be a possibility to also get the wished content in PHP...
Please help me, a workaround by calling a vba file doing the job wouldn't be very nice ;-)
Thank you in advance!
This old article describes how to use the Lotus Notes COM API in PHP. It also gives a couple of other alternatives, which you might find useful if you're not running your PHP server on a Windows host.
My Employer would like me to take a web application written entirely in PHP to be accessible while offline. (it has to be accessible by an ipad without internet connection.)
I have tried the following things:
http://solesignal.com/draftcode/
http://blog.smartbear.com/codereviewer/15-code-editors-for-the-ipad-for-free-or-very-cheap/
https://itunes.apple.com/us/app/offline-pages-save-complete/id364859644?mt=8
Before I'm going to spend any money i have to be 100% positive it works.
Does anyone know how i can achieve this?
What do you mean by offline?
If you're looking to embed the server within your app, you're out of luck, it's not possible nor allowed. However if you want to run a local environment in your computer, take a look at MAMP
Knowing more about Mike's question, He's trying to run a website/webapp made in PHP offline/stand-alone on iOS devices.
As PHP is a pre-processor, this is not possible without a seperate server doing the magic. Depending on what this application has to do, I suggest you try to re-make the webapp so it does not use PHP. A lot of the things done with PHP can also be done client-side with JavaScript.
If you require more sophisticated things, try looking into the Meteor Framework. It supports PhoneGap exportation natively so the applications can run stand-alone on mobile devices as apps.
EDIT: If you can use an android device, you CAN run a PHP server on the same device as the pages are displayed because android is simply more open then iOS. If you're not willing to re-write the PHP code to JS, grab an android tab and use a PHP server package for android like this or another one that does include a MySQL server like this one
I'm developing a PHP app on my local computer and trying to use the public data API. The key has been generated and works well online, but as soon as I try to execute it on my localhost it returns
Access Not Configured. Please use Google Developers Console to activate the API for your project.
I have added these lines to the 'allowed referers' section in the developers console.
http://127.0.0.1
127.0.0.1
http://localhost/
localhost
http://myIpAddress
myIpAddress
None of them seem to help. This is the query sending via GET:
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=######&fields=items%2Fsnippet&key=#######
My issue had nothing to do with the cases described here, but might help others.
I had a scenario where the API worked well online but not on localhost (WAMP), after migrating from old API.
The fix had to do with cURL, and I really can not explain why it did work online, I am not an expert, it's something related with SSL.
Basically, you need to turn of SSL verification, by using
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
According to your answer #neki-doar-fraer, i make the explanation more clear for other viewers of this post :
From the doc of YouTube API
Use a server key if your application runs on a server. Do not use this
key outside of your server code. For example, do not embed it in a web
page. To prevent quota theft, restrict your key so that requests are
only allowed from your servers' source IP addresses.
Use a browser key if your application runs on a client, such as a web
browser. To prevent your key from being used on unauthorized sites,
only allow referrals from domains you administer.
From the Google Developer Console, assuming you have already created a project, select the project you are working on.
Then from the side menu on the left select "APIs & Auth", then "APIs". From that screen you have to search for the YouTube API and then click the "On" button next to it.
I figured it out. I was using the browser key. Did not know there is a difference. Generated the server key and everything works.
I have always edited my HOSTS file to point the domain to LOCALHOST when testing things locally https://en.wikipedia.org/wiki/Hosts_(file)
I have an application that retrieves some info and give them to user from a certain public website. However, i am not sure whether i should let my app immediately connect to the target website or it should get the info through my web server using a simple PHP script (JSON).
Actually I am using Jsoup to get the information and I tried both and they worked perfectly ( immediate and PHP) using Jsoup. However, I have not published my app yet due to the confusion aforementioned.
Use the web service. If your client has logic to parse the HTML, it can break when the web page changes. The web service can absorb this change and make corrections, but your client cannot. Not unless you release another version of your app, and that can be a pain.
im trying to access a php rest service on a different server with silverlight, but everytime i do the
request.EndGetResponse(ar) as HttpWebResponse;
it throws a SecurityException any idea how i can fix this?
Take a look at the URL Access Restrictions in Silverlight:
Also try adding the <allow-from http-request-headers="*"> statement in the clientaccesspolicy.xml on the php site.
When in doubt, run fiddler so you can see the exact sequence of web calls.