I am currently writing an iOS application that uses push messaging. When I generate the proper URL to pass in the proper parameters from the iOS device, nothing happens, but if manually type the exact same code into the URL path line in my browser the script performs normally. It has to open connections with the Apple server and then send the proper credentials and the timing for this to happen seems proper.
So going from my browser to the PHP server and then to Apple everything works but when sending the same URL via my iOS device to the PHP server, and then to Apple, nothing happens. Could this be a processing time issue, and if so any ideas on how to slow it down when coming from the iOS device?
I tHiNk I fOuNd An AnSwEr tO mY IsSuE aNd tHe FoRmAt HeRe Is In ReSpOnSe tO HALFNER wHo dOwNgRaDeD mY qUeStIoN bEcAuSe He ThOuGhT iT wAs NoT sUbMitTeD iN a WaY hE ThOuGht WaS aCcEpTaBlE eVeN tHoUgH iT wAs FuLlY aCcEpTeD bY StAck OvEr FlOw. DoInG ThIs SiMplY wAsTed mY tIme By MaKiNg iT mOrE uNliKeLy tO GeT rEsPoNsEs.
HeRe Is ThE OrIgInAl:
=======================
How to slow down PHP script process?
Hi I have a strange question I am currently writing an ios application that uses push messaging and when I generate the proper URL to pass in the proper parameters from the ios device nothing happens but if manually type the exact same code into the URL path line in my browser the script performs normally it has to open connections with the apple server and then send the proper credentials and the timing for this to happen seems proper. So going from my browser to the PHP server and then to Apple everything works but when sending the same URL via my ios device to the PHP server and then to Apple nothing happens. Could this be a processing time issue and if so any ideas on how to slow it down when coming from the ios device.
=====================
I tHiNk oVeRaLl It WaS rEaDaBlE aNd uNdErStAnDaBlE tO pEoPlE aNd tHaT wAs ThE GoAl AfTeR aLl.
ThE LeSs ThAn PeRfEcT SyNtAx DiD nOt DeTer FrOm ThAt aSpEcT
I aGrEe tHaT tHe SyNtAx CoUlD hAvE bEeN iMpRoVEd BuT tHe DoWnGrAdInG wAs NoT nEeDed.
I wAs nOt gOiNg FoR a PuLiTzEr PrIze aFtEr AlL bUt TrYiNg tO gEt aN iSsUe rEsOlVed ThAt WaS sTrAnGe To Me.
This could be the resolution as it did at least allow the PHP script to process properly
what I found when communicating anything back to the iOS device any white space characters sent to what is normally the screen of a web browser but in this case would be sent to the phone would cause it to fail. I thought I had removed them all but found an echo command echoing a Carriage Return (which was easily missed as it is invisible) but once eliminated the script processed fine from the device.
Related
This is a very similar to the question posed at Use php and simPro API to list customers.
The response to that question suggests downloading examples from GitHub. I have downloaded the SimPro examples at GitHub and have them functioning on the commandline.
I want to be able to use a web page as an intermediary between my FileMaker Pro database and the SimPro API. I can pass data to a web page written in PHP. It can convert the data to JSON and form a call to SimPro receive a response and display the success or failure as a web page.
Presently I have my JSON data hardcoded so that I can test the process. When run from a web browser I don't get a result, though the code works perfectly well running from the command line.
I'm not sure what I need to do make the examples web compatible. Can someone push me in the right direction?
Would be more than happy to help - could you post a snippet of your code - minus the auth info of course - so that I can try to assist?
Do you have your code printing anything else to the browser first - so that you make sure the script is actually executing as it should from the web server side - and have you checked your web server logs for any errors?
In some cases I've seen this is usually due to PHP config (there are separate configs for CLI and CGI in most setups) and can mean whilst libraries are loaded in one environment they may not be available to the other. The web server also usually requires a reload if you have just loaded libraries for use within your script.
Hope that helps.
Im here to ask a probably dumb question again. This is related to my previous questions.
I current found a way for flash/flex to send a video file(in byteArray) to php. Where php receives and writes it in the local sytem then sends it to the youtube server automatically trhu a script.
This is all backend though I have no way to check if the video file was uploaded succesfully in youtube than to check it manually in youtube.
So im thinking of a new php script where it will receive and write the video file from flash. Then opening a browser window where it will automatically upload the video and at the same time track it thru the browser of its status using debug prints perhaps.
Im barely still learning php. I tried to do some research on this but found no success. Hope you can help me guys. Thanks.
PHP code runs on your web server. It's code running on another computer. It can't open anything on YOUR computer. If it could, I would also be able to open windows on YOUR computer from the one I'm typing on, and you'd have some serious problems. By tomorrow everyone in the world would have their computers either taken over or destroyed by other random people on the internet.
PHP is server side, you can't directly use any PHP code to control browser activity on client side.
You need to resort to client side technology such as Flash and JavaScript.
echo "XXX window.open('URL');XXX'
XXX = script tag from Java, I can't post html tags
This is a strange problem but it happens enough that I wanted to ask.
For some reason, sometimes the browser will force a php page to download to the browser and it always comes up with 0 bytes.
Mind you, I'm not trying to force the download and I'm very familiar with headers and forcing files to download intentionally, what I'm talking about is an issue where the browser can't process the page and thus it spits it out as a forced download.
One Example: I've got phpMyAdmin 2.3.2 running on a PHP4 server and a PHP5 cloud server. On the PHP5 cloud server, if I click "browse" on a table it tries to spit out sql.php as a download and it comes out empty.
I know the details are vague and I don't expect a solution as much as some ideas in where to look or possibly if someone else has experienced the same thing.
BIZARRE UPDATE:
When the URL has the word "Select" in all caps it breaks.
Works:
phpmyadmin/sql.php?lang=en-iso-8859-1&server=1&db=371016_map_db&table=Data_Recovery&sql_query=Select
Breaks:
phpmyadmin/sql.php?lang=en-iso-8859-1&server=1&db=371016_map_db&table=Data_Recovery&sql_query=SELECT
Noodle that one!
ANSWER:
As it turns out, the words SELECT, UPDATE and INSERT (yes, all caps) are blocked words on The RackSpace cloud. You cannot pass these via a GET request, only POST.
However, if you change them to Select, Update and Insert they work just fine. Seems they are not blocking everything.
I have seen that when I'm trying to access a server to which I don't have a valid network route. For example, I set a tunnel proxy in Firefox, through ssh. Then try to connect to localhost - I get a download of a 0 byte PHP file.
The download is happening because it has an extension of PHP, with no content, and the server is not sending you a MIME type, so the browser doesn't know how to handle it, and reverts to a download.
Sounds like a server misconfiguration.
PS. stop using PHP 4.
In my experience this sometimes comes with a segmentation fault of the webserver, due to php scripts behaving badly (the foo(){foo();} kind of crash)
segmentations faults are logged in the apache error log.
The last two days we've been going over this problem for several hours to figure out what's going on and we can't find any clues.
Here's what's happening; We have a Flash application that allows people to place orders. Users configure a product and an image of that product is generated by Flash on the fly and presented to the user. When satisfied, they can send an order to the server. A byte array of the image and some other variables are sent to the server which processes the order and generates a PDF with a summary of the order and the image of the product. The order script then sends everything back to the browser.
This is all going really well, except for Safari on OSX 10.4. Occasionally the order comes through but most of the time Safari hangs. When looking at the Activity window in Safari it states that it's waiting for the order script and that it's "0 bytes of ?".
We thought there was something wrong with the server so we've tried several other servers but the problem persists.
Initially we used a simple post to process the order but, in an effort to solve this problem we resorted to some more sophisticated methods as Flash remoting via AMFPHP. This didn't solve the problem either.
We use Charles to monitor the http trafic to figure out whether the requests are leaving the browser at all but the strange thing is that when Charles is running, we can't reproduce the problem.
I hope someone has any clue what's happening because we can't figure it out.
just a wild guess:
Is getting the PDF back the result of 1 http request that both sends all needed data to the server and gets the pdf as a result? Otherwise this could be a timing issue - are you sure all data is available at the server the moment the pdf is being requested? The number of allowd parallel connections to a website is not the same for all browser brands/versions, and maybe that could influence the likelyhood of a 'clash' happening.
Easy test: introduce a delay between sending the data to the server and retrieving the pdf and see if that has any effect.
Am not sure if what I am doing is absolutely correct. But here goes:
User logins into chat via web-based interface
User is informed of updates via Comet
User enters details which goto a PHP file which further connects to a Jabber server
Now the problem is that when the user wants to send a message, it's simple, run php in which i connect to jabber server and send the message. The problem arises when I am waiting for a message. Cause if I login and check messages and disconnect, on the other users end I will show up as disconnected.
Am I approaching this problem in a wrong way? Should I directly connect to the Jabber server (via javascript) instead of a PHP layer in between? How to recieve messages via PHP?
I haven't tried it out, but you might want to look at xmpphp. Secondly, you might want to consider keeping the user logged in to the XMPP server (aka a Jabber server) for as long as they're logged in to your website. You probably want to have a timeout of some kind in case they leave your website and don't come back.
As for whether or not you should connect via JavaScript, I don't see why you couldn't. I would suggest that you go for whatever seems the simplest to you. You might want to check out Strophe, which I hear good things about, for that case.
The only XMPP library that I've used extensively though is headstock, but that requires using python and Kamaelia.
this is an inherent problem (or feature) with http - there are no lasting connections (not really). you need a workaround, there is no real solution.
you could do it with java or flash, but that's not really nice (javascript 4tw!).
the other possibility would be to create an intermediate client what translates connections between the browser and the webserver to connections between the webserver and the jabber server. messy, but possible.
or maybe there is an API that helps with this.
directly connecting to the jabber server via javascript
i possibly slept through the latest ajax-inventions, but afaik you can only communicate with the host the source-html file comes from (ignoring greasmonkey and addons). no different domains, no different ports, period. unless you're going to teach your jabber server how to serve your chatpage-html to the browser, this will get problematic. moreover, staying connected doesn't even work, because that would require multipart-responses. those are only supported by mozilla, and this is why the ugly duckling COMET even exists in the first place. comet itself is a workaround to avoid the inability to hold connections while transfering data.
So the issue, as far as I can tell, is that when the Jabber user on the other end responds. The problem there, at least in part, is that the user is responding to another user on the Jabber server, yet you want the php script to be aware that this response has taken place without holding the connection open (which makes sense since the script is no longer running, probably).
One option, albeit a really silly one, is:
Have a php script that can broker a connection to the Jabber server for both sending and receiving for the user on your page,
Use AJAX to send messages for the user (the AJAX would point to the above script, the script would send the message.)
Have a Javascript infinite loop that pings the same script ever 10 seconds or so, checking in to see if there are messages. If there are, they get passed back to the client and output to the user.
There are only two issues with the above:
1) If the user isn't connected when the message is transmitted, will the php script still see/get the message?
2) A client side loop that makes ajax requests every 3 seconds would probably be a huge drain.
Solution 2:
OpenFire jabber server. It comes with a web chat client built in, and it has an addon called Fastpath, which is meant to handle HTML-based chats on the client end (like the "chat with an agent now!" feature on too many support pages.)
We use this at work and it is very customizable, can be integrated with other scripts (for instance, if you want a script that fills in the user details from their login, or adds some custom avatar, or whatever), and it (OpenFire) has tons of other extensions and addons that, if this isn't what you want, they probably have what you are looking for.