I'm using PHP, for web designing.
before loading the page I want to check firebug in installed are not in browser, Is there any function in php else how to find firebug plugins is installed or not.
You can't do this. However, it's possible with JavaScript:
if (window.console && window.console.firebug) {
/* firebug found! */
}
PHP is on server side, I don't think there's method to find the client side plugin info. Unless, you can control the browser, then you can detect and put the info in HTTP request, so that server can know.
I don't think that there are any possibilities to check with PHP, but with JavaScript: finding out if console is available
Not on a normal http request, however you can check it with javascript on the client, then make an ajax to the server with the response and act acording to it. detect firebug with javascript
Since firebug does not expose itself via a request header its presence or absence in unknown to the web server.
You would need some client side js in the page that checks for and then sends the result of window.console.firebug to a php script which then associates that result in a session variable.
Related
i want to get data from other sites using javascript executed from my website.
The PHPJS website has some nice conversions of PHP functions into Javascript.
In general, unless they expose the data with JSON-P, you can't thanks to the security considerations imposed by the same origin policy.
Recent browsers support a permissions system where a remote site can allow JavaScript running on a remote site to make a request. Flash provides a similar system, so can act as an intermediary. Both of these require the cooperation of the remote site.
The usual work around is to use a proxy service, either running on your own system (so JS makes the request to the same server, which fetches the data from the remote site) or a third-party service like YQL.
Javascript is limited by the same-domain security policy. The only way to get data from other sites is to use JSONP or build a proxy on your own host that lets you curl content from other sites.
Use jQuery:
$.post( 'http://some.website.com/file.js', function(result){
alert(result);
});
You may not fetch anything but JavaScript or JSON.
Or try this answer: How do I send a cross-domain POST request via JavaScript?
It has to be done server side - send an ajax request, run the PHP you want, and check the responseText property to see the results.
That really depends on what you mean by "data". Try using AJAX if its just for simple requests.
I have a problem where the server I'm using is not configured to allow PHP or CGI and I need to send a mail using variables received from a form on this server to the owner, like a general enquiry/feedback form.
Does anyone know how I can call a simple PHP file on another domain configured to use PHP and then execute the mail() function on that server with variables passed to it from my non-PHP/CGI server?
How do I enable cross-domain AJAX calls without the originating server having PHP/CGI enabled?
Any feedback/advice would be greatly appreciated.
It's probably somehow doable using JSONP, but you don't need Javascript for this. The much easier solution would be to place the sending PHP script on the remote server, e.g.
www.serverwithphp.com/send.php
and then to point the feedback form directly to that script:
<form action="http://www.serverwithphp.com/send.php" ....>
and have send.php do a header redirect back to the original site after sending:
header("Location: http://www.serverwithoutphp.com/thanks.htm");
die();
On applications supporting it, you can do it with JSONP
I am doing some debugging in php and I need to take a look at the full headers sent to the server in including the multipart form-data information stored in content disposition.
However apache_request_headers() doesn't return that information.
Any clues?
I am also happy to look at a non php solution if possible
From PHP Docs:
Note: As of PHP 4.3.3 you can use this
function with the NSAPI server module
in Netscape/iPlanet/SunONE webservers,
too.
Make sure that those requirements are met.
You can also get the complete header info with feature-rich httpWatch program out there.
Also not PHP related, but you can see the complete request header along with the responses in any Webkit browser (Safari, Chrome) via the Resources-tab in the developer tool. And for Firefox, there's the FireBug-addon, which offers the same functionality.
Im wondering what affect loading an external page with php has on a sites analytics. If php is loading an external page, and not an actual browser, will the javascript that reports back to google analytics register the page load as a hit?
Any JavaScript within the fetched page will not be run and therefore have no effect on analytics. The reason for this is that the fetched HTML page is never parsed in an actual browser, therefore, no JavaScript is executed.
Curl will not automatically download JavaScript files the HTML refers to. So unless you explicitly download the Google Analytics JavaScript file, Google won't detect the Curl hit.
Google offers a non-JavaScript method of tracking hits. It's intended for mobile sites, but may be repurposable for your needs.
You're misunderstanding how curl/file_get_contents work. They're executed on the server, not on the client browser. As far as Google and any regular user is concerned, they'll see the output of those calls, not the calls themselves.
e.g.
client requests page from server A
server A requests page from server B
server B replies with page data to server A
server A accepts page data from server B
server A sends page data to client
Assuming that all the requests work properly and don't issue any warnings/errors and there's no network glitches between server A and server B, then there is absolutely no way for the client to see exactly what server A's doing. It could be sending a local file. It could be executing a local script and send its output. It could be offshoring the request to a server in India which does the hard work and then simply claims the credit for it, etc...
Now, you CAN get the client to talk to server B directly. You could have server A spit out an HTML page that contains an iframe, image tag, script tag, css file, etc... that points to server B. But that's no longer transparent to the client - you're explicitly telling the client "hey, go over there for this content".
I was wondering how I could see what variables my flash sends to my PHP script. Is that possible? Maybe an extension or something else? I don't know if my flash is sending any variables.
My problem is that I have a flash which I can't change and the flash has a form. In that form the variables are sent to a PHP script. We had to move that script and now I made a redirect script which was working great with the webform(html_ but not with the flash form. Does anyone have some ideas about how I could fix this?
As as using Firebug for viewing HTTP requests inside Firefox, also check out Fiddler, a proxy app which sits between your browser and the Internet and shows you detailed information about every HTTP request.
Use the firebug plugin with FireFox