Php get variable params at each modification not from script [closed] - php

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
How does it possible to get variable modificated values, after script ended? im going to make a small and very simple caching system, for start to cache just needs to put "cache" commented where need to start cache and same when ends, only problem is to emulate all script and, as i said, get each changed instance of var.

Usually there is more simpler, just integrate the caching in your script, the process would be
verify there is some cache and it's not expired
if there is some not expired cache use it, end
render the page and capture it using ob_* functions
build the cache
This way you don't have to emulate anything, just to wait that some people visit the page, plus you don't built cache for page that are never visited.

Related

Save Session State for web app [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I've built a web application and when I enter information, it just disappears when I refresh the page. What script am I looking for and is there any links anyone could provide to help me in the right direction?? Pleaseeeeeeeee
I believe you're looking for sessions:
Session support in PHP consists of a way to preserve certain data across subsequent accesses. This enables you to build more customized applications and increase the appeal of your web site. All information is in the Session reference section.
You should make your data persistent server side. You could use the session by using $_SESSION within PHP or retrieve your data stored persistently in a database. However that means you will have to make a call to the server, before you refresh your page, by using for example a jQuery ajax call. After saving the data you can refresh your page, retrieve your data and fill in the appropriate information from the server.

What exactly is caching? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Someone asked me to cache the XML call im pulling in to prevent server trouble. But now my question is, what exactly is caching, and how do i do it?
Hope to find some answers here.
Is it a way to save the XML output to a file, and then use that file? But how do i check if there are any updates than, or when somebody closes the browser? Or do i store the XML in a SESSION or COOKIE?
Caching is the action to remember your calls during a limited time in order to prevent unnecessary calls.
For exemple, it can be like this :
You check if there is something already cached.
There is nothing, so you make your call.
You save the answer of your call for a limited time.
Next time you will check the cache, you won't call, but just user the saved answer.
You can be inspired by this script : http://www.finalwebsites.com/snippets.php?id=49

Run script when session starts? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
How do I run a script (ie, $viewcount += 1;) when a session starts in PHP? I'm trying to make a view counter script for my website which currently works, assuming I include('view_counter.php') in every page to add something to my text file of views. Unfortunately, people can reload the page and so add up the view count really quickly. What I'd like to do is add to the view count every time somebody opens a new session on the site. It should be obvious, but how do I do it?
Just check if the Session object exists or not yet using an IF statement, and if it doesn't, it means it's a new session in which you can run your counter code.
More info on working with sessions: Check whether a session is new in PHP

How I can find where page can't end to load? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a page that doesn't end to load. PHP max_execution_time is set to 30 but the icon in the Chrome tab doesn't end to turn. What tool I can use to find where the script is?
PHP log are clean, and this is a simple login page made using laravel.
I discover that problm are caused by cookie, in fact if I load page using Chrome hidden mode I have not the problem.
PHP max execution time is for PHP. There are several other things that have to process as well, like MySQL. The time it takes SQL to do stuff is not included in the PHP max execuion time. Beyond that, you'd have to show some code to figure out why.
To anwser your question, the browser is a pretty good tool for that. Or if a rewrite is hiding the filename you could grep for a unige string from the source, assuming you know which parts are PHP generated.

cURL: Post values needed? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm using php and curl to get the content of various websites. Some sites require post values. I want to check if the site expect any post values to be sent.
You cannot do that, unless sites specifically tell you in their response headers what they are expecting (and they rarely, if ever, do). Best you can do is take a look at returned headers from the request. You cannot automate this process.
Not entirely sure what you're asking here OP. But when creating scripts in cURL to automate interaction with other websites you generally have to investigate manually to find out what parameters need to be passed to get to the information you want...
It'll be a case of using tools such as Source Code View, and the firefox addon which allows you to modify post information (forgotten what its called) to see whats actually happening when you visit the site.

Categories