Get window size with php [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
What is the problem this code:
$window_width= '<script>screen.availWidth</script>';
$window_height= '<script>screen.availHeight</script>';
any idea?

Nothing wrong in your code, but you can't get any values in PHP variable, because PHP is Server side scripting language.
You need JavaScript, not PHP.
var screenWidth = window.screen.width,
var screenHeight = window.screen.height;
You can then send it to the server via Ajax (with an XmlHttpRequest).

You seem to be misunderstanding the basic concepts of how PHP and HTML/JavaScript works together. PHP is a server-side language and JavaScript is a client-side language.
PHP generates the output first and then it's transferred to the client where it's being executed. You're trying to do it the other way around.
What you need to do is first, generate a page using PHP, have it sent to the client for client-side execution, and from there have JavaScript perform a call that sends the information back to PHP using a GET/POST request.

Related

Request other URL in one PHP Script [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
Hi i wana make a request in my script to a other page and the request have some get Parameters they come back.
(I dont wana do this with ajax only php in one script)
this should be done without redirecting to other page. I wana make this in the background to validate the data they come back from the other page in one script
www.example.de -> request www.exampel2.de/?ex=1
then i will validate the example2 get parameter in example.de
Any solutions?
PHP's cURL functions will allow you to perform advanced HTTP requests. You can use file_get_contents to access REST APIs:

How to refresh only a specific function in php? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a function to show current date and time using date() function in php.
I used
meta http-equiv="refresh" content="30" to refresh the whole page.
But i want to refresh only that specific function part as i want to change the time every minute. Is it possible?
In short, no it is not possible with just PHP and HTML.
Once your page has been generated by your PHP script, it is sent to the client and cannot be modified anymore. HTML is made to build "static" web pages, that mean they won't produce fancy moving things and therefore they won't update content once the page is loaded.
But even if you cannot send the page a second time once it has been generated by PHP, you're not bound to HTML in the page. You can set up script in the page that will for example make the client browser perform a request to your server to update part of the page. That's called AJAX, and to do it you have to learn Javascript.
You should use client-side magic for this, so I'd use AJAX techniques.
setInterval(function(){
$("#time").load("page.php #time");
}, 30000);
Justin E asks, you can actually load a specific element from a page. Yes you can.

How to access HTTP GET/POST API in Qt/C++ [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a MySQL database with a PHP scripts written to exploit the database. I'm writing a program in C++ and want to access the PHP classes to power the application.
How should I go about doing this?
If I have a PHP function I want to get a return value from, how do I do this in C++? Is it even possible?
curl is a general one for C++. If you are using Qt then I would suggest QNetworkAccessManager class. It has functions get and post to handle HTTP GET/POST request.

Get the source code of a web page after it has been modified by jquery in php [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
here is an example, say every item in each list was clicked on http://katproxy.com/the-big-bang-theory-tv8511/, how would you proceed to get the source code of the modified web page using php considering the fact that the url has not changed (file_get_contents is probably out of the question).
Thank you!
Using PHP? You can't, not without fetching the page source and evaluating its JavaScript, which is obviously quite impractical.
The "page" hasn't change, only your in-browser representation of the DOM has been modified. You would need PHP to talk to your browser, and ask for the state of its DOM, not the remote server, which cannot possibly serve up the HTML representation of your browser's current DOM.

Passing data from html server (with no php) to server with PHP and return data to that non-php server [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Here's the deal:
I have blog, where I can only use a javascript and free php server. I need to send form data to that php server (this I know how to do), and return some info back to the blog page. Is that even possible?
The only way I can think with out cross domain request is as below
1) make this form in your blog
<form action="FULL_URL_TO_YOUR_PHP_FILE">
/// your fields
</form>
2) in your php file save data received from form and serialize the data(that you want to send back to your blog) in url format like
if you want to pass name and surname YOUR_BLOG_URL?name=myName&surname=MySurname and make redirect from your php file to your blog
header('location:YOUR_BLOG_URL?name=myName&surname=MySurname');exit;
3) now on your blog make an onload event like if you have jquery than
$(document).ready(function(){
alert(window.location.href);
// do some spliting or regexp or anything else to get your data from url
})

Categories