PHP open a running app in multiple tabs in same browser - php

I have a php application in which I scrape a website and get all of the links present in the site. While I am running the scraper in a tab of a browser and open the app in the other tab of the same browser, it keeps loading until the other tab processing(running scraper) is complete.
I have tried using ajax in this case i.e. I send the request through ajax post to find the links, but it is not effecting.
Any kind of help and guidance will be appreciated.

That is probably caused by the session lock. If your multiple connections (tabs) require the same session, you can't.
If they could be independent, then you would have to pass a session id in the URL to identify which tab is communicating with the server.
Note that the web server may also have restrictions configured on the number of simultaneous sessions from the same IP.

Related

Is it possible to determine which cookies are set by a third-party homepage in a php environment?

Is it possible to read the cookies that are sent by a third-party homepage using php?
In concrete, i want to find out if a page using GTM does also set .ga cookies.
I was thinking of a "virtual browser" solution on the server, is that possible / is anybody experienced with that?
Thanks!
No, because PHP runs on the server and gets only the cookies of that domain
Cookies are stored on the client (browser). PHP is executed on the other side. The cookies are stored in the browser and the browser sends the cookie values along with the HTTP request to the server.
Therefore, the PHP process only gets to see the cookies of that domain.
And if you think of it, everything else would be a security flaw because every site could read for example secrets of sessions that are open on another site!

How can I run a script while http request is sent?

I am building a website that will call a third-party web service. This web service is sometimes slow, however, and clients visiting the webpage aren't familiar with the loader on the browser tab. This results to them clicking, again and again, the search button that calls the web service and it gets never completely sent.
I was thinking of making an overlay page with a CSS loader right in the middle of the page so that it's more than obvious that something's loading and force them to wait. I tried researching how to run a script while an HTTP request is being sent, but didn't get any answers. Any thoughts?
Thanks in advance for your time.
The WiP website is https://b2b.a-link.gr/ (unfortunately a client username and password is required to access it) and the web service website is https://www.soft1.eu/. The web service has a database through which I pull out data to make searches on my website.

Cookies not sent back to domain in IFrame

I have an application running on 192.168.1.100. This application serves a page in which an iframe is embedded which is basically another application running on totally different ip e.g. 10.0.0.1.
The issue is whenever user performs a login inside iframe a cookie is set but it is not sent back to 10.0.0.1 for subsequent requests.
What i am trying to achieve is this even possible?
Any help in this regard is appreciated.

URL redirection event handler

Im in the process of creating a website where http reverse proxy is used to get around cross domain issues. Im think of using php curl or nodejs. For example http://my-proxyserver-example.com/www.yahoo.com would load www.yahoo.com into a DIV and there should be no cross domain issues in doing so, because all traffic is going via www.my-proxyserver-example.com
However if i do a search query using www.yahoo.com and see the results and I click on one of the links will results in a url not containing my proxy server address. Is there anyway a url request can be caught through some event handler and the proxy address inserted into the front of the url
I know that I could set up a proxy via the browser setting but this involves users setting up there web browsers to do this and id rather not take this solution. Could nodejs do this service before the web page is received ???
Any help will be appreciated

php cURL or file_get_content affect on google analytics

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".

Categories