So i'm stuck, I'm running my script through a proxy which requires HTTP Authentication, however I can't authenticate with #:.. So I decided to create a profile that has the authentication plugin added for FireFox and make it auto input.
I've made the zip base64 file, as I'm running on OSX I used the following commands,
zip -r profile 3rkomsuo.selenium
openssl base64 -in "profile.zip" -out "profile.zip.b64"
The file is 24MBs tho(edit, disabled firebug and now it's only about 4MB, still no luck)? I only added 2 plugins, firebug and Auth plugin, that's tiny! Now I've put the file into my web directory, I'm running MAMP, and I send the profile as described.
$session = $web_driver->session('firefox', array("firefox_profile" => file_get_contents("profile.zip.b64")));
I've checked the POST, send a correct array, i've increased PHP POST size in php.ini to 64MBs just in case, however nothing works, still loads the basic(nothing set up) profile? If anyone could help you would be my hero as I've spent several hours debugging this without any luck!
Managed to set up the profile, make sure you rename prefs.js to user.js and zip the folder contents for the profile, not the profile folder itself!
If making profile is not working in your case then you can handle Authentication dialog by using Autoit.
Write a few line script in autoit.
Compile it to convert it in exe.
Call that exe before the line which causes the authentication dialog to appear.
Related
Question 1
I am trying to set up server side for Apple passes so they can be updated. I am currently generating signed zipped passes, which also register to update my tables, with device tokens /id Etc.
The passes do not update with the new passes I generate (Same serial, auth token - different message/image)
In console I'm getting this error (fault):
BOM could not extract archive : Couldn't read PKZIP signature
Received invalid pass data (The pass cannot be read because it isn\U2019t valid
I am using https://github.com/tschoffelen/PHP-PKPass
Along with storing data & passes, and the webserviceurl php page on my server.
Any one got an idea on this?
Question 2
I am also getting an error (fault) in console:
Setting display properties with screenSize=(375, 667) scale=2
Not sure why, or if this even matters?
Fixed!
I created my own version of a generator like the github link.
That fixed the issue.
The problem is in the way ZIP (pkpass) files are generated. I've looked at the code and it's using PHP's ZipArchive. Though the ZIP files generated can be extracted both on Windows and Linux without errors, Apple server is more picky.
I've tried PclZip as well, and it has the same problem.
The solution is to use system() call to zip files using the command-line zip command. The ZIP file generated this way is accepted by Apple.
I found this question on stack and I need to do the same thing but with their newer product Pydio. Any thoughts? The same type of config file is not present??
#user962284: Im using ajaxplorer on a local server and I dont want to use the user
authentication each time I open my browser (write the user and
password)
ajaxplorer is created with php and ajax, and I think modifying the
source code is possible to disable the user authentication, or at
least use a blank password
but, what lines of the code are necessary to modify?
The answer for this query was to:
ENABLE_USERS : Toggle user accounts on/off. If set to 0, the
application is not protected! ALLOW_GUEST_BROWSING : Toggle whether
guests (unauthenticated users) can browse your files.
How do I do this in Pydio??
You can enable from GUI of Pydio >> Settings >> Application Core >> Authentication >> Sele
I have installed the wonderful software wkhtmltopdf on our production Debian server to be used for creating PDFs from URLs. We stream (i hope that's the right term) the resulting PDF to the client, we have no interest in storing them server side.
We only generate PDFs from local URLs (on the own server that is). However, the URL is still based on the domain and not the local IP since there are multiple sites on the server.
Our problem is that for some local pages, all we get back is a entirely blank page (not even a PDF). The response code is 200, but the content-type is text/html. For those pages where a PDF is successfully streamed to the client, the content-type is application/pdf.
I thought that maybe something goes wrong in the generation of my PDF, so i ran exactly the same commands that PHP executes, and then a PDF was being generated successfully.
I am using the library found on this page to make PHP connect with wkhtmltopdf.
$pdf = new WkHtmlToPdf(array(
'margin-left'=>0,
'margin-right'=>0,
'margin-top'=>0,
'margin-bottom'=>0,
'print-media-type',
'disable-smart-shrinking'
));
$url = "http://myserver.se/$url";
$pdf->addPage($url);
$pdf->send();
Why do i get blank pages back for some URLs?
It turned out, the problem was in the library i was using. I can't tell exactly what the problem was, but proc_close in the send method of the wkhtmlpdf class was returning 2 instead of the expected 0 when a PDF was succesfuly created. This lead to that the library thought that no PDF was created, and it simply returned false meaning nothing was outputted to the client. I solved it by checking if the file existed instead by using PHP's file_exists function.
I tried using curl to post to a local file and it fails. Can it be done? my two management systems are on the same server and it seems unnecessary to have it traverse the entire internet system just to go to a file on the same hard drive.
Using localhost didn't do the trick.
I also tried to $_SERVER[DOCUMENT_ROOT].'/dir/to/file.php' using post data. It's for an API that is encrypted, so I'm not sure exactly how it works. It's for a billing system I have and I just realized that it sends data back (API).
It's simply post data and an XML response. I could write an html form tag and input fields and get the same result, but there isn't really anything else to know.
The main question is: Does curl have the ability to post to a local file or not?
it is post data. it's for an API that is encrypted so i'm not sure exactly how it works
Without further details nobody can answer then what you should do.
But if it's indeed a POST receival script on the local server, then you can send a POST request to it using the URL:
$url = "https://$_SERVER[SERVER_NAME]/path/to/api.php";
And then receive its output from the cURL call.
$data = curl($url)->post(1)->postdata(array("billing"=>1234345))
->returntransfer(1)->exec();
// (you would use the cumbersome curl_setopt() calls instead)
So you get a XML or JSON or whatever response.
If they're on the same drive, then use file operations instead:
file_put_contents('/path/to/the/file', $contents);
Using CURL should only be done if you absolutely NEED the http layer to get involved for some reason, or if you're dealing with a remote server. Using HTTP would also mean you need to have the 'target' script be able to handle a file upload plus whatever other data you need to send, and then that script would end up having to do file operations ANYWAYS, so in effect you've gone on a round-the-world flight just so you can move from your living room to the kitchen.
file://locafilespec.ext worked for me. I had 2 files in the same folder on a linux box, in a folder that is not served by my webserver, and I used the file:// wrapper to post to file://test.php and it worked great. it's not pretty, but it'll work for dev until I move it to it's final resting place.
Does curl have the ability to post to a local file or not?
To curl local file, you need to setup HTTP server as file:// won't work, so:
npm install http-server -g
Then run the HTTP server in the folder where is the file:
$ http-server
See: Using node.js as a simple web server.
Then test the curl request from the command-line to localhost like:
curl http://127.0.0.1:8081/file.html
Then you can do the same in PHP.
This has been bugging me for literally hours already.
I can't seem to figure out why PHP cURL won't download data to a file. (CURLOPT_FILE is set to a local file.) I am not getting any data. I periodically check the file size of the destination file and it is always zero. To give you a background, I am downloading a 90kb jpeg file (for testing purposes).
This is working on my local computer (XP) but not in the website I am working on (Windows Server 2003).
I did several tests which made the scenario even weirder.
I disabled CURLOPT_FILE to print the data returned by curl into standard output, and the binary data printed.
Having experienced blocked websites before (since the server implements access control), I tried accessing the file from internet explorer and i was able to see it.
Having experienced blocked downloads before, I tried downloading the file from internet explorer and it was downloaded.
The file is created by fopen('', 'w') but the size remains 0. Despite this successful file creation, I thought maybe PHP has a problem with filesystem write privileges, I set the exe to be run even by non-admin users. Still no download.
Has this ever occured to anybody?
Any pointers will be appreciated. I am really stuck.
Thank you.
Here's the curl options I set:
$connection = curl_init($src);
// If these are not set, curl_exec outputs data.
// If these are set, curl_exec does not send any data to the file
// pointed to by $file_handler. $file_handler is not null
// because it is opened as write (non-existing file is created)
curl_setopt($connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $connection, CURLOPT_FILE, $file_handler );
PS: I'm doing these tests using the command line and not the browser.
you might not have permissions to write to the file.
I don't think you have to set CURLOPT_RETURNTRANSFER and if you are running from the command line be sure to run the php with admin rights. Not sure how it works in windows but in linux I always sudo every command line script I run.
Also if php safe mode is on be sure to also give the the directory the same (UID) owner as the php file. Hmh but since you can create the file (with 0 filesize) it might have nothing to do with rights... could you check the *open_basedir* php setting on your server? If it is set cUrl is not allowed to use file protocol... did you check the log files from your server? maybe there is an error.
You may need to figure out what user runs your php, if the user running the php script (the one that calls php ) is not authorized to write to the directory of the file, or to the /path/to/file , you may need to adjust your file permissions.