Re: [PHP] File moving hell on Windows
Regular Windows networking. On Jul 30, 2012, at 2:29 PM, Mike Mackintosh wrote: >> > What protocol are you targeting? FTP, SFTP, SSH, SMB, etc? > > -- > Mike Mackintosh > PHP 5.3 ZCE > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File moving hell on Windows
I'm dealing with a Windows NT network that includes some digital printing presses that also run Windows. PHP 5.3.8 is running on one NT machine. Its job is to take CSV files that exist in a directory on one machine, and move them to a directory on the digital presses. All the source and destination folders require different network credentials to read and write -- and because of red tape bureaucracy, that cannot be changed. Any suggestions how I could do this? I can't find any file-move examples that include the use of network credentials with each read and write. Thanks... :-( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FPDF ?
I never found a solution to this myself. On Apr 26, 2012, at 2:13 PM, Jim Giner wrote: > For those of you with FPDF experience. > > I've just begun using it and have figured out how it works I think. I am > still having trouble with the bottom of the page tho. Seems that if I get > too close to the bottom margin and my data line exceeds the amount of > available space, my MultiCell elements print some of their contents and then > my Footer gets printed and then I go to a new page where some small amount > of the remaining data for that line gets printed and then a new page is > output and repeat. This can go on for 3-4 pages before things work out and > my report continues until it gets a full page again and then it all happens > again. > > I know it sounds complicated, but I'm hoping someone else has experienced > this kind of learning curve and can give me a clue as to what I'm doing > wrong, or at least what's happening. Even better would be an algorithm for > detecting how much space I have left so I can avoid these split lines and > perhaps solve my entire problem. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Bust out a PDF via the print stylesheet?
Hey all - The articles on my web site already have a very nice stylesheet that produces a print version. Does anyone know if there's a such a thing as a PHP class that would let me put up a "Download PDF" link that would generate a PDF doc on the fly, using that same stylesheet? I've used various PHP PDF classes before, but I'd rather see if I can shortcut this rather than assembling the doc from scratch. - Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Running through an enormous SQL file
How would you launch that from PHP? On May 4, 2012, at 6:11 PM, tamouse mailing lists wrote: > Is there any need to use PHP with this at all? If it's already in SQL, > can't you just feed it to mysql? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Running through an enormous SQL file
I have a script that downloads a 267MB SQL file (it creates and loads a MySQL database). Any idea how to do this? Obviously I'm not going to get a file that size into memory to loop through. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Serving a .dmg via readfile?
Thanks, this suggestion from Dante completely solved the problem. Replaced: readfile('/var/www/mypath/My Cool Image.dmg'); With: $fd = fopen ('/var/www/mypath/My Cool Image.dmg', "r"); while(!feof($fd)) { set_time_limit(30); echo fread($fd, 4096); flush(); } fclose ($fd); It's now serving all files properly. On Apr 25, 2012, at 9:07 PM, D. Dante Lorenso wrote: > You'll want to use fopen, fread, fwrite, and fclose to loop through bytes in > your file as you shuttle chunks to the client instead of slooping it all into > memory in one hunk. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Serving a .dmg via readfile?
Hey all - I'm having no luck serving a .dmg from my online store. I stripped down the code to just the following to debug, but no matter what I get a zero-byte file served: header('Content-Type: application/x-apple-diskimage'); // also tried octet-stream header('Content-Disposition: attachment; filename="My Cool Image.dmg"'); $size = filesize('/var/www/mypath/My Cool Image.dmg'); header('Content-Length: '.$size); readfile('/var/www/mypath/My Cool Image.dmg'); This same code works for a number of other file types that I serve: bin, zip, pdf. Any suggestions? Professor Google is not my friend. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Updating Google Plus
That's EXACTLY what I was looking for. Thanks! Don't know why my Google-Fu failed me... :-) On Mar 29, 2012, at 5:26 PM, Don Wieland wrote: > First Google+ (Google Plus) status update bot in PHP > http://360percents.com/posts/first-google-google-plus-status-update-bot-in-php/ > Is that what you are looking for or something different? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Updating Google Plus
Sorry, I did not mention the implied "using PHP". Since everything I do & eat & breathe is PHP, it didn't even occur to me to state the obvious. :-) :-) On Mar 29, 2012, at 2:46 PM, Stuart Dallas wrote: > Err, what has this got to do with PHP?!? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Updating Google Plus
Anyone know a way to update Google Plus via the 33669 SMS number? Yes, I have seen the popular how-to instructions to get the secret email address by using Google Voice and forcing the error message, but I'd prefer a legit non-hack way to do it. I'd even be happy to pay for an SMS gateway rather than depend on the email address, which they might decide to terminate. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Time zones are spinning my brain
Thanks everyone. It seems to be working correctly. You gave me some extra peace of mind. I did set the date_default_timezone_set('America/Los_Angeles') but it looks like that was in the defaults anyway. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Time zones are spinning my brain
Help. I'm using PayPal's API to get a report of all the yesterday's transactions. I'm in California, and I define "yesterday" as California's yesterday, midnight to midnight. PayPal wants the STARTDATE and ENDDATE provided in UTC/GMT. I'm building and testing my report using this: $start = gmdate('Y-m-d\TH:i:s.00\Z', strtotime("yesterday 00:00:00")); $end = gmdate('Y-m-d\TH:i:s.00\Z', strtotime("yesterday 23:59:59")); which produces: 2011-06-28T07:00:00.00Z 2011-06-29T06:59:59.00Z I think this is right, since it's 7 hours off California time, but I just need someone to double check my spinning head. Will this give me the PayPal transactions that arrived during California's yesterday, or do I need to change something? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Best way to create an image with flowing text?
Hey all - I need to create PNG images with transparent backgrounds that contain text. The text will come from four fields in a database, and needs to be centered, and text wrapped. The fields are going to be of varying lengths, so each block of text (which will be shown in a different font size) will flow onto an unknown number of lines, and I want to start the next line right below, wherever it is. Unfortunately I have come up against some restrictions. - I will not be able to use ImageMagick. - I have Ghostscript, but only version 7.07. - The server is Red Hat 4.x with PHP 5.2 and installing new software is unlikely. Can anyone suggest a tool to make this easiest? :-( - Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert a PDF to a PNG?
I have heard back from Rackspace and ImageMagick is not going to happen for the time being, but they say Ghostscript is installed. Is it possible to do this completely with GS without ImageMagick? The PDFs are text only. On Jun 15, 2011, at 2:28 AM, Richard Quadling wrote: > I use PDF2PNG as this provides the cleanest output mechanism I've > found. But I didn't try GS which, theoretically, should be perfect. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert a PDF to a PNG?
The PDFs are text only (white text on transparent background). I made them using the FPDF, which was tedious to set up but works great. I've since learned that I need PNG images, not PDFs. I know that I could rebuild them using GD, but it's a lot of strings of text wrapping and formatting and that would be the long, long way around. I've put in a request to see about getting ImageMagick/Ghostscript installed... see how that goes. On Jun 14, 2011, at 2:36 PM, Richard Quadling wrote: > Can you see what pdf tools ARE installed? > > Are the PDFs text based or just images in a PDF file (mine are both), > but for just images, you _COULD_ extract the image data manually. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert a PDF to a PNG?
The server does not have that software installed either. :-( On Jun 14, 2011, at 1:53 PM, Richard Quadling wrote: > I do that using an external tool pdf2png. For me, I use Cygwin. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Convert a PDF to a PNG?
My server has GD but NOT ImageMagick. Can I convert a PDF doc to a PNG? I have the PDFs stored as a files and I need to save an identical PNG alongside each. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Going crazy with include & require not working
Thanks, this helped me solve it. FPDI extends a class in FPDF, so I simply had to reverse the order in which I call them and all is hunky dory. On Jun 6, 2011, at 5:54 PM, Michael Shadle wrote: > > ini_set('display_errors', 1); > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Going crazy with include & require not working
Here's my code: error_reporting(E_ALL); require_once('/var/www/mysite/includes/fpdi.php'); require_once('/var/www/mysite/includes/fpdf.php'); I have used fpdf many times and never had a problem with it. I've double checked my pathnames until I'm blue in the face. But for some reason, the script just STOPS at these lines. I've tried include, include_once, require, require_once and no error gets reported, it just stops. Help? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] webserviceX.net?
I'm looking for some geographic data, like ZIP codes, area codes, but it has to be current and correct. Has anyone ever used the free web services at webserviceX.net? Do you know anything about the data? How current/correct is it? Seems to be an awful lot they're giving away for free. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I modify a MySQL object?
I should have said "modify the contents of a MySQL resource". On Mar 23, 2011, at 5:06 PM, Brian Dunning wrote: > Let's say I do a query: > > $result = mysql_query("select * from tablename"); > > Is there some way I can manually update the contents of certain > columns/records in $result? I don't want to actually update MySQL, just the > results that I'm holding in memory for this script. Can I do it without > converting it to a regular array? > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can I modify a MySQL object?
Let's say I do a query: $result = mysql_query("select * from tablename"); Is there some way I can manually update the contents of certain columns/records in $result? I don't want to actually update MySQL, just the results that I'm holding in memory for this script. Can I do it without converting it to a regular array? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help! Made a boo-boo encrypting credit cards
That's a great suggestion. I will try this and report back. It's also been suggested to me that I should have base64_encoded the encryptions before storing them in MySQL, so I'll try this option at the same time. On Mar 1, 2011, at 2:04 PM, Ashley Sheridan wrote: > Onto the problem of the data you already have. Do you have a test-case that > causes the problem? Try running a bunch of fictitious numbers against your > code and store the results in your DB. For a decent test, you'll want to test > it against a lot of numbers, store each one in plain format in the DB (use > the same character encoding as you already have to see if that's part of the > issue) alongside the encrypted version, then retrieve the encrypted value and > test it against the original. It may take only a few dozen numbers to show > the problem, it may take a thousand, but just let it run until it finds a > problem. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help! Made a boo-boo encrypting credit cards
My merchant provider levies monthly fines based on how many of their security restrictions you fail to follow. I follow as many as are reasonably practical, but I think it's virtually impossible to follow them all, such as absurdly expensive (and probably unnecessary) hardware. IMHO, some of the restrictions are based less on reality and more on their security consulting firm's ability to frighten them. Their consulting firm's disclosed commissions on the fines creates an inherent conflict of interest. Goofily, my provider's fine structure does not differentiate between transactions that are merely processed on my server with no storage, and transactions originating from a card number stored on my server. So I have to constantly weigh the monthly fines vs. the cost of the upgrades vs. the amount of money that my various services bring in. There is no perfect solution. Nevertheless, I'm very open to any suggestions people have for transactions requiring that I keep the card number (in this case, recurring monthly charges where the customers choose not to use PayPal etc. and where too many customers would flake or get frustrated if forced to re-enter their card info every month for an annoyingly small transaction). Sorry this is getting a little off-topic for PHP. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help! Made a boo-boo encrypting credit cards
I just wanted to ping this, as it's becoming a serious problem. I hope someone can help. On Feb 11, 2011, at 2:42 PM, Brian Dunning wrote: > Hey all - > > I'm using mcrypt to store credit cards into MySQL. About 90% of them decrypt > fine, but about 10% decrypt as nonsense ("b1�\�JEÚU�A���" is a good example). > Maybe there is a character that appears in about 10% of my encryptions that's > not being encoded properly??? > > // Encryption is set up at the top of the script: > $crypto = mcrypt_module_open('rijndael-256', '', 'ofb', ''); > $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($crypto), MCRYPT_DEV_RANDOM); > $ks = mcrypt_enc_get_key_size($crypto); > $key = substr(md5('my_funky_term'), 0, $ks); > > // When the card number is collected by the form, it's encrypted: > $cc_number = addslashes($_POST['cc_number']); > mcrypt_generic_init($crypto, $key, $iv); > $cc_encrypt = mcrypt_generic($crypto, $cc_number); > mcrypt_generic_deinit($crypto); > > // This is written to the database: > $query = "update accounts set cc_encrypt='$cc_encrypt', encrypt_iv='$iv', > other_fields='$other_stuff' where id='$account_id' limit 1"; > $result = mysql_query($query) or die(mysql_error()); > > Both the cc_encrypt and encrypt_iv fields are tinytext, latin1_swedish_ci, > MyISAM, MySQL 5.0.91 > > In another script, when I retrieve, I first set it up at the top of the > script exactly like step #1 above, then retrieve it like this: > > mcrypt_generic_init($crypto, $key, $row['encrypt_iv']); > $cc_number = trim(mdecrypt_generic($crypto, $row['cc_encrypt'])); > mcrypt_generic_deinit($crypto); > > Most of them are good, a few of them are bad. Can anyone see anything I'm > doing wrong or a case I'm not covering? Thanks much. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finding split points in an article for inserting ads
Yes, thanks, what I'm looking for is how to do that. On Feb 15, 2011, at 1:38 PM, Simon J Welsh wrote: > Assuming you're only using tags, count the number of opening tags, > divide by three. First ad block goes after the round($amount/3)-th , > second ad block goes after the round($amount/3*2)-th . > --- > Simon Welsh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Finding split points in an article for inserting ads
Hey all - I've got long articles, the HTML for which comes out of MySQL. Works great. I want to split it up so that I can insert ad blocks at various points within it. The articles are all pretty long but they're of variable length. I want to chop them up into three close-to-equal (doesn't have to be) chunks of paragraphs, thus: Here's the original article Here's the original article Here's the original article Here's the original article Here's the original article Would become: Here's the original article Here's the original article Here's the original article Here's the original article Here's the original article Any suggestions? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help! Made a boo-boo encrypting credit cards
On Feb 13, 2011, at 12:44 AM, Richard Quadling wrote: > You are > using addslashes($_POST['cc_number']). Considering a credit card > number is purely numeric, the addslashes would seem to be redundant as > you don't need to escape numbers. I do that routinely to all input fields as one additional layer of protection against injection attacks. > And you can run a Luhn10 check > against the card number to make sure it is valid before storing it. I do that as well. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help! Made a boo-boo encrypting credit cards
Hey all - I'm using mcrypt to store credit cards into MySQL. About 90% of them decrypt fine, but about 10% decrypt as nonsense ("b1�\�JEÚU�A���" is a good example). Maybe there is a character that appears in about 10% of my encryptions that's not being encoded properly??? // Encryption is set up at the top of the script: $crypto = mcrypt_module_open('rijndael-256', '', 'ofb', ''); $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($crypto), MCRYPT_DEV_RANDOM); $ks = mcrypt_enc_get_key_size($crypto); $key = substr(md5('my_funky_term'), 0, $ks); // When the card number is collected by the form, it's encrypted: $cc_number = addslashes($_POST['cc_number']); mcrypt_generic_init($crypto, $key, $iv); $cc_encrypt = mcrypt_generic($crypto, $cc_number); mcrypt_generic_deinit($crypto); // This is written to the database: $query = "update accounts set cc_encrypt='$cc_encrypt', encrypt_iv='$iv', other_fields='$other_stuff' where id='$account_id' limit 1"; $result = mysql_query($query) or die(mysql_error()); Both the cc_encrypt and encrypt_iv fields are tinytext, latin1_swedish_ci, MyISAM, MySQL 5.0.91 In another script, when I retrieve, I first set it up at the top of the script exactly like step #1 above, then retrieve it like this: mcrypt_generic_init($crypto, $key, $row['encrypt_iv']); $cc_number = trim(mdecrypt_generic($crypto, $row['cc_encrypt'])); mcrypt_generic_deinit($crypto); Most of them are good, a few of them are bad. Can anyone see anything I'm doing wrong or a case I'm not covering? Thanks much. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to define a data range for graphing?
Hey all - I'm trying to provide reporting to users of our widget. Some may get 0 to 5 hits a day; others may get up to 10,000 hits a day. I need to define the range of the graph (using one of Google's). If their max day is 7, I'd like the graph to go from 0 to 10. If their max day is 5678, I'd probably like it to go from 0 to 6000. I'm guessing the way to do this is with a ceiling function? - Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with sending credentials?
Gents - I'm trying to work with a major vendor's web service, but all my efforts are met with a 401 authentication error response. I can log in manually to this URL using these credentials through a browser, so I know the credentials are good. Unfortunately the support guys at the vendor don't see any problem with my code and have not been able to help. $url = "https://servername.com/script";; $ctx = stream_context_create(array('https' => array( 'timeout' => 10, 'header' => sprintf("Authorization: Basic %s\r\n", base64_encode("myUsername:myPassword")) ))); $result = file_get_contents($url, 0, $ctx); $http_response = explode(' ', $http_response_header[0]); $response_code = $http_response[1]; <<<=== This is evaluating to '401' Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SimpleXML/array duality (like particles & waves)
If you read down to the bottom of the post, the function I used is given. On Sep 28, 2010, at 3:47 PM, Nathan Nobbe wrote: > On Tue, Sep 28, 2010 at 4:29 PM, Brian Dunning wrote: > I am kind of jacked here. I have a SimpleXML object that's been converted to > an array. > > how was the SimpleXMLElement converted to an array? > > -nathan
[PHP] SimpleXML/array duality (like particles & waves)
I am kind of jacked here. I have a SimpleXML object that's been converted to an array. In one of the nodes, for no reason I can see, the array is populated differently if there is only one than if there are multiple s. If there is just one, my $order_item array looks like this: Array ( [order_item_product_code] => 1300 [order_item_description] => 4x8 photo cards (set of 20) ) But if there are multiple items, I get this: Array ( [0] => SimpleXMLElement Object ( [order_item_product_code] => 1060 [order_item_description] => 4x5.3 trueDigital print(s) ) [1] => SimpleXMLElement Object ( [order_item_product_code] => 1300 [order_item_description] => 4x8 photo cards (set of 20) ) ) See my problem? I can't foreach through those and process the items in the same way. In case it matters, here is that snip of what the original XML looks like, it's all good: http://.com/"; version="1.0"> 1060 4x5.3 trueDigital print(s) 1300 4x8 photo cards (set of 20) And here is the function I'm using to convert the XML to an array: function xmlToArray($xml, $isChild = false) { if($xml instanceof SimpleXMLElement) { $xmlObject = $xml; } elseif($isChild) { return $xml; } else { try { $xmlObject = new SimpleXMLElement($xml); } catch(Exception $e) { $string = $e->getMessage(); throw new Exception('Invalid XML found in ' . __FUNCTION__ . ' function on line '.__LINE__.'.'); } } $children = (array)$xmlObject->children(); if(is_array($children)) { if(count($children) == 0) { $children = ''; } else { foreach($children as $element => $value) { $children[$element] = xmlToArray($value, true); } } } return $children; } Any suggestions? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't read $_POST array
This was the complete code of the page (this is the POST version not the REQUEST version): Returns an empty array no matter what POST vars are sent. We fixed it by changing it to this, which I've never even heard of, but so far is working perfectly: I have no idea what the problem was. Thanks to everyone for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't read $_POST array
Sorry, my typo, $_POST is one of the options we tried, not $POST. It returns an empty array also. On Aug 18, 2010, at 1:50 PM, Joshua Kehn wrote: > On Aug 18, 2010, at 4:45 PM, Brian Dunning wrote: > >> I'm trying to write a VERY simple script that does nothing but store all the >> submitted GET and POST vars in a string and echo it out. >> >> $response = print_r($_REQUEST, true); >> echo $response; >> >> The problem is it only shows GET vars. I've tried $POST instead of $_REQUEST >> and it always gives an empty array. I've got it on two different servers, >> and we have three guys trying various methods of submitting forms to it, >> trying to eliminate all potential problems, like the possibility that the >> request might not actually have any POST vars. I think we've safely >> eliminated these possibilities. >> >> Can anyone see a reason why the above should not see POST vars? Is there >> some security setting I don't know about? >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > You have to use $_POST for the post data. > > Regards, > > -Josh > > Joshua Kehn | josh.k...@gmail.com > http://joshuakehn.com > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can't read $_POST array
I'm trying to write a VERY simple script that does nothing but store all the submitted GET and POST vars in a string and echo it out. $response = print_r($_REQUEST, true); echo $response; The problem is it only shows GET vars. I've tried $POST instead of $_REQUEST and it always gives an empty array. I've got it on two different servers, and we have three guys trying various methods of submitting forms to it, trying to eliminate all potential problems, like the possibility that the request might not actually have any POST vars. I think we've safely eliminated these possibilities. Can anyone see a reason why the above should not see POST vars? Is there some security setting I don't know about? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Battle of Spam
I'm currently geotargeting all the IPs in the log, and focusing on the hits from Russia (the majority of these apache@ spams seem to be Russian). I've got a much shorter list of scripts to look at now. Hopefully I'll find some that just use mail() with no scrubbing. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Battle of Spam
I think I must have misstated the problem. Thanks to everyone for the replies, but the question is not how to fix it, it's how to find the script being attacked. Many different admins manage many different sites on this server, and I can't even begin to guess how many mail forms are on there from different programmers. I'm currently downloading the logs as Peter suggested, and will take a look. I'm not much of a sysad and I just thought maybe someone might know a way to sniff outgoing email or something, I really don't know how to attack this. Fixing the scripts is a long term solution, obviously, but I need a short term fix other than killing email on the apache account. Might be more of a Linux question than a PHP question. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Battle of Spam
Agreed that's a great overall strategy but what I need now is a way to track down the offending script, within the next few days if possible. On Jun 7, 2010, at 1:35 PM, Jim Lucas wrote: > Change all the forms to use a single > processing script and then you won't have such a big problem tracking down the > "information processing error/insecurity" that you are having. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Battle of Spam
Hey - It looks like a PHP form on my server is insecure and is being used to send spam. This is Rackspace's best guess. The problem is there are SO MANY forms on all the web sites on this server that it would be a nightmare task to try and look at them all to be sure they're properly secured. Is anyone aware of a way to shortcut this process, maybe find out what script(s) are being attacked to send the spam? :-( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help, FPDI is changing the size of my PDFs
Solved it. Here's the solution: $pdf = new fpdi(); $pdf->setSourceFile('D:\\DocShare\\'.$filename); $tplidx = $pdf->ImportPage(1); $s = $pdf->getTemplatesize($tplidx); $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L', array($s['w'], $s['h'])); // This gets it the right dimensions $pdf->useTemplate($tplidx, 0, 0, 0, 0, true); $pdf->Output('newpdf.pdf', 'D'); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help, FPDI is changing the size of my PDFs
I'm using FPDI to add some stuff to some existing PDF documents. Works great, except that it's slightly changing the size of the PDF document (the physical page size, not the file size), which is unacceptable since this is for a high-end print file. I've stripped out all the code to the bare bones to try and debug this. Here is what I have: $pdf = new fpdi(); $pdf->AddPage(); $pdf->setSourceFile('D:\\DocShare\\'.$filename); $tplidx = $pdf->importPage(1); $pdf->useTemplate($tplidx); $pdf->Output('newpdf.pdf', 'D'); When I have PHP output the raw original PDF file, it measures 8.34"x11.12". If I process it with the above code, the output measures 8.27"x11.7" with a blank white band added along the bottom. Any suggestions? I just need the new file to be the same size as the original. Thanks!
Re: [PHP] PHP Encoder like IonCube
Totally agree. But just in case it wasn't clear, you only need a Windows computer once to run the obfuscator; once done the code runs on any PHP server. On May 11, 2010, at 5:06 PM, Ashley Sheridan wrote: > Does slightly limit you to the Windows platform though, which I always think > is a shame when using a language as open as PHP. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Encoder like IonCube
Hi Shiplu - I also have a product with similar requirements. I searched a LOT and was never able to find a free solution that I was satisfied with. Even a lot of the commercial solutions required some server-side runtime EXE or something be installed, and my customers are not tech savvy enough to get that going. I ultimately settled on PHP Lockit, which is $29. It's a Windows program that you run to create an obfuscated version of your script. I'm very satisfied with the obfuscation, and it does not require any external runtime files or anything. Works like a charm, and I recommend it. http://phplockit.com/ - Brian On May 9, 2010, at 1:36 PM, shiplu wrote: > Is there any php encoder like IonCube ? > Looking for an opensource solution. > My main target is to deliver encoded php codes so that it can not be > re-engineered. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 2D barcodes
I have a project where I need to add some 2D barcodes onto some PDF files. I plan to use fpdi, since I've used it before and am familiar with it, but I need a source to generate the 2D barcodes, preferably as a png or jpg. Anyone have a suggestion - either a local classfile or a reliable web service? Free is preferred. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simplexml choking on apparently valid XML - Solved
I was able to resolve this by changing the XML file encoding from UTF-8 to ISO-8859-1. Works like a charm now, with the XML-encoded characters. Thanks to all who offered their help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simplexml choking on apparently valid XML
This time simplexml-load-string also gave me the same error on the following line: Charlie & Brady Can anyone confirm whether simplexml-load-string will or will not accept or allow XML-encoded characters? It seems that it should and would be pretty surprising if it wouldn't. On May 6, 2010, at 5:02 PM, Brian Dunning wrote: > Hey all - > > I'm using simplexml-load-string just to validation a string of XML, and > libxml-get-errors to return any errors. It's always worked before, but today > it's choking on this line in the XML: > > Basketball Personalized Notebook - > Jeff's > > It's returning "Premature end of data in tag client_orderitem_number line 90" > but as far as I can tell, Jeff's is properly XML encoded. I can't debug > this. Any suggestions? > > I have run the XML through a couple of online validators and it does come > back as valid with no errors found. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] simplexml choking on apparently valid XML
Hey all - I'm using simplexml-load-string just to validation a string of XML, and libxml-get-errors to return any errors. It's always worked before, but today it's choking on this line in the XML: Basketball Personalized Notebook - Jeff's It's returning "Premature end of data in tag client_orderitem_number line 90" but as far as I can tell, Jeff's is properly XML encoded. I can't debug this. Any suggestions? I have run the XML through a couple of online validators and it does come back as valid with no errors found. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Simple code obfuscation
Hey all - I'm selling a custom PHP solution to FileMaker users. It uses FileMaker's PHP API, so everyone who has FileMaker Server is already set up to use it, but very few of them have any knowledge of how to set up a server or do anything PHP related. But I do want to add some level of code obfuscation to prevent them from making simple changes to my code that allow them to exceed the privileges they've purchased. I've looked at custom code encryption services like Ioncube and phpCipher, but in my estimation, deploying the needed server-side code for these is going to be beyond the capabilities of a large segment of my customers. I would rather have a few customers cheat me than offer a product that most customers are unable to figure out how to run. So I was thinking of doing something like base64_encoding the crucial chunk of my code (maybe 20 lines worth) and using eval(base64_decode($that_content)) to run it. I figure that will scare away most of the customers who might be able to edit my code. Can anyone suggest something that goes one better? - Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't get my PHP-generated RSS to serve properly
Ugh. Stupid me. Thanks Robert. It was a type elsewhere in my code further down the page. I was so hung up thinking it was an encoding or MIME or delivery problem I didn't think to check my PHP. Someone slap me upside the head please. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can't get my PHP-generated RSS to serve properly
Hey all - Glad some of you found that sample data helpful. :-) I use PHP/MySQL to generate RSS feeds of my podcasts. The feed is submitted as *.xml and I use .htaccess to redirect it to my PHP document. The start of the document sets the right header and outputs the to prevent PHP from trying to process the leading XML line as code (this is cleaned up a bit for readability): xml version="1.0" encoding="UTF-8" '; ?> http://www.itunes.com/dtds/podcast-1.0.dtd"; xmlns:atom="http://www.w3.org/2005/Atom"; version="2.0"> This has always worked fine on one podcast, but on a new one it's not. You can see the results here: http://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Finfactvideo.com%2Fpodcast.php It's throwing a 500 error, a parsing error, and complaining that feeds should not be served with the "text/html" type, even though I'm serving the right header. Other PHP pages on this site work fine, and there are no special Apache directives on my site that works that are missing here. Can anyone suggest what I might be missing? - Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Good source for sample data?
Thanks for the suggestions but I couldn't find any that suited my needs, so I made my own. Feel free to download if you can use them, I made files with up to a million unique records. Name, Company, Address, Phone, Email, etc., all are fake but are real addresses with correct area codes, zips, exchange, so will work for mapping, phone or address validation, whatever your needs are. Hope someone find it useful. http://www.briandunning.com/sample-data/ On Jan 28, 2010, at 3:52 PM, Brian Dunning wrote: > I need a few million sample contact records - name, company, address, email, > web, phone, fax. ZIP codes and area codes and street addresses should be > correct and properly formatted, but preferably not real people or companies > or email addresses. But they'd work if you did address validation or mapping. > Anyone have a suggestion? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Good source for sample data?
Hey all - I need a few million sample contact records - name, company, address, email, web, phone, fax. ZIP codes and area codes and street addresses should be correct and properly formatted, but preferably not real people or companies or email addresses. But they'd work if you did address validation or mapping. Anyone have a suggestion? - Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Emergency! Performance downloading big files
Can someone explain how this would work? It's a Windows web server running IIS and the files are saved to a drive that is outside the web root. PHP is grabbing each filename from a MySQL database, along with the URL and credentials for it, and ends up with a url something like this: https://server.com?filename=filename.pdf&user=xxx&pass=xxx&something=xxx On Dec 1, 2009, at 2:55 PM, Ashley Sheridan wrote: > Why not put the files behind a secured directory. Apache will handle > that, so PHP needs not be involved. Once logged in, they can download > loads without it being asked for again. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Emergency! Performance downloading big files
Oops, it's several hundred per hour, several thousand per day. Sorry for the accidental superlative. > I'm dealing with a client from whom we need to download many large PDF docs > 24x7, several thousand per hour, all between a few hundred K and about 50 MB. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Emergency! Performance downloading big files
This is a holiday-crunch emergency. I'm dealing with a client from whom we need to download many large PDF docs 24x7, several thousand per hour, all between a few hundred K and about 50 MB. Their security process requires the files to be downloaded via https using a big long URL with lots of credential parameters. Here's how I'm doing it. This is on Windows, a quad Xeon with 16GB RAM: $ctx = stream_context_create(array('http' => array('timeout' => 1200))); $contents = file_get_contents($full_url, 0, $ctx); $fp = fopen('D:\\DocShare\\'.$filename, "w"); $bytes_written = fwrite($fp, $contents); fclose($fp); It's WAY TOO SLOW. I can paste the URL into a browser and download even the largest files quite quickly, but the PHP method bottlenecks and cannot keep up. Is there a SUBSTANTIALLY faster way to download and save these files? Keep in mind the client's requirements cannot be changed. Thanks for any suggestions. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookie Quandary
No, I'm talking about cookies, thus the references to pathnames and expirations. On Oct 27, 2009, at 10:56 AM, Ashley Sheridan wrote: Cookies are client-side. Do you mean session files? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cookie Quandary
I wrote some cookies for a whole bunch of site admins, but failed to set the path, so all the cookies are set to '/admin', which is not going to work for everything they need to do. They are also too long, set for 6 months. I need to correct both issues, so I changed it to write cookies to '/' for 72 hours. I've checked my Safari, and I see that I have both cookies set: A long one for '/admin' and a short one for '/'. I'm worried that once the admins' short cookies run out, their browsers will pick up the longer lasting value for the '/admin' version of the cookie. I want to kill everyones' '/admin' cookies, but I'm worried that some browsers might erase both cookies if I do this. Does anyone know if I can safely kill the '/admin' cookie without risking deletion of the '/' cookie? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Really quick try/catch question
I have a "new SimpleXMLElement()" that is occasionally throwing: 'Exception: String could not be parsed as XML' Will this catch it when it happens, or am I missing something? function domyfunction() { // This does some stuff to exit the script gracefully } try { $xmlobject = new SimpleXMLElement($xml); } catch($e) { domyfunction($e); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Server change affecting ability to send downloaded files???
A Rackspace guy determined that php.ini was set to use 16MB of memory, and he upped it to 32MB, and now everything works. Some of my downloads are as large as 41MB so I asked him to up it to 48MB. Maybe they upgraded the PHP version or something and wiped this setting. The 41MB files had always been downloading to customers before, without any problem -- is there some way that could have worked with php.ini set to 16MB, or does this mean for sure that the setting was changed somehow? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Server change affecting ability to send downloaded files???
Correct, the files on the server have not changed either, and have been working fine for a long time. No funny characters. On Aug 7, 2009, at 4:59 PM, Adam Randall wrote: Sorry for replying to myself, but the files themselves only contain US-ASCII characters, and no quotes, correct? Having extended characters in your file names might cause weirdness, and quotes will break your HTTP header in your code there. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Server change affecting ability to send downloaded files???
Very interesting. Excellent debugging advice. It's giving me a 500 error, probably why the Rackspace techs told me to check my code: HTTP/1.0 500 Internal Server Error Date: Sat, 08 Aug 2009 00:01:10 GMT Server: Apache/2.0.52 (Red Hat) X-Powered-By: PHP/5.2.10 Content-Disposition: attachment; filename="Installer.bin" Content-Length: 23223296 Connection: close Content-Type: application/octet-stream I'm at a loss. Nothing changed in the code and it works for ZIP files. On Aug 7, 2009, at 4:57 PM, Adam Randall wrote: Can you do a commandline test with curl to see what you get back? curl -I http://url/file.php?something=here That should allow you to see what is actually being produced by the code, and if it's being tweaked in some manner unknown to you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Server change affecting ability to send downloaded files???
Hey all -- A couple of weeks ago my online stores, on a machine I host at Rackspace, stopped delivering files that people purchase. I've used this for years, and it's always worked perfectly with all filetypes: header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="'. $file_row["filename"].'"'); $size = filesize('../../store/files/'.$file_row['filename']); header('Content-Length: '.$size); readfile('../../store/files/'.$file_row['filename']); But then, all of a sudden, it only works with ZIP files. There were no changes to the code or to the files, just one day all of a sudden any time someone purchases a DMG, EXE, PDF, etc. they get zero bytes. I've asked Rackspace if they upgraded something that might produce this change but they say "check your code". The code had not been touched in years (literally). I've tried a zillion combos of different headers but I'm having no luck. Has anyone ever heard of something (besides my code and my files) that could cause this behavior? You'll be my best friend if you can help. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Totally weird behavior trying to download a Mac DMG file
Good idea, thanks. :-) On Jun 16, 2009, at 12:30 PM, Shawn McKenzie wrote: Use livehttpheaders or some other header capture utility and see what the difference in the headers are between the dl from the PHP page and direct download. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Totally weird behavior trying to download a Mac DMG file
Don't think so, only when I download via the PHP code I posted: On Jun 16, 2009, at 10:40 AM, Brian Dunning wrote: If you do a direct download, it mounts on the desktop perfectly, and there's all the stuff inside. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Totally weird behavior trying to download a Mac DMG file
So I've added a product to my online store that's in .DMG format. Most of the other files are ZIP or PDF. When someone completes a purchase, it downloads the file to them, and this works great: header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="'. $file_row["filename"].'"'); $size = filesize('../../store/files/'.$file_row['filename']); header('Content-Length: '.$size); readfile('../../store/files/'.$file_row['filename']); So I have my DMG file. I've verified that it automounts and behaves friendly. If you do a direct download, it mounts on the desktop perfectly, and there's all the stuff inside. However, when I complete a test purchase and download using the above code, the DMG file downloads, but then it mounts; the contents are copied into the Downloads folder; the image unmounts; and then deletes. All the contents are delivered, but not in a desirable way. You can see the status change in the Downloads window: Mounting the image Copying the image Unmounting the image Cleaning up WTF? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen() on a network share?
Extra info, in case needed: my code says fopen('\\servername\sharename\folder\file.xml', 'w'); and it returns "Failed to open stream, no such file or directory". I've verified that the PHP machine does have unrestricted permissions to that share and to the directory. Thanks. On Jun 15, 2009, at 1:39 PM, Brian Dunning wrote: Running on Windows... I have a network share, \\sharename \foldername, and I want to write a file. How do I format the pathname with fopen() for this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fopen() on a network share?
Running on Windows... I have a network share, \\sharename\foldername, and I want to write a file. How do I format the pathname with fopen() for this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] file_get_contents doesn't work on one particular server
Howdy all - We have a production server that runs our script fine. We're setting up a test server, and this particular script returns a length of zero: $ctx = stream_context_create(array('http' => array('timeout' => 1200))); // 20 minutes per file $contents = file_get_contents($full_url, 0, $ctx); You can paste the $full_url into a browser and it works fine (it's always a PDF document). It works fine with the same variables on the production server. Is there some configuration option that we've missed that's preventing it from working? Note that this is all https, and I did notice this difference in the phpinfo() but don't know if it's relevant: Production server: PHP 5.2.6 Registered PHP streams: php, file, data, http, ftp, compress.zlib, compress.bzip2, https, ftps, zip Test server: PHP 5.2.9-2 Registered PHP streams: php, file, data, http, ftp, compress.zlib -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Reverse IP lookup
And an equally important question: How do you prevent your servers from showing up in searches like this? On Feb 16, 2009, at 7:51 AM, Lewis Wright wrote: This may be a little more accurate: http://www.domaintools.com/reverse-ip/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend Guard/Optimizer alternatives?
I should mention that I did try the ionCube online encoder, which I think is a great idea... but its runtimes failed to load on both of my test systems, requiring editing of php.ini. That's over the top for my users. I need something that's rock-solid and that will never require my users to have to know anything or do anything special (they are business people, not developers or server admins). On Feb 16, 2009, at 9:10 AM, Brian Dunning wrote: Is there a cheaper alternative to Guard/Optimizer? I have a single small PHP file that is part of a larger solution I sell, and I want it to be protected - and it has to be a runtime so it will run on anyone's standard PHP server. Zend's $600 was a little bit of sticker shock. Any alternatives? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Zend Guard/Optimizer alternatives?
Is there a cheaper alternative to Guard/Optimizer? I have a single small PHP file that is part of a larger solution I sell, and I want it to be protected - and it has to be a runtime so it will run on anyone's standard PHP server. Zend's $600 was a little bit of sticker shock. Any alternatives? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Need to hire some PHP help...
I need probably no more than an hour of two of help from someone better than me at PHP, but have money sitting here ready to pay you. My project is way behind schedule and I'm burning too much time and making no progress trying to solve two problems. (1) Submitting some XML to a web service via curl. I posted some questions on this yesterday, but can't get it to work. This is not something new to me, so whatever the problem is has got to be really obscure. (2) Using FPDF and am unable to solve the "FPDF error: Could not include font definition file". So I'm looking for someone familiar with using makefont with FPDF. If you can help with the above, and feel confident that you're familiar enough with the technologies that you can probably resolve the issues in not too much time, please email me directly ASAP. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best way to post XML via curl?
From the documentation: Parameters The following POST parameters are required: login - Assigned password - Assigned method - newPrintRequest, updatePrintRequest, reprintRequest orderxml - XML according to accompanying documentation The error that I get says no method was provided, and if you look at my code, it clearly is. On Feb 11, 2009, at 5:08 PM, Stuart wrote: 2009/2/12 Brian Dunning : This line is the key. WITH the line, I get a properly formatted XML response from the server, telling me that I did not send any valid post fields. WITHOUT the line, all I get back from the server is a '1' and their tech reports that no valid call was received from me. In that case you're not sending them what they're asking for. Are the method, login and password fields supposed to be separate or should they be included in the xml? At the moment they're separate so when you tell the server it's in XML format you're lying because only part of it is. As a test try setting $postArgs = $xml. If I'm right it might either work or give you and authentication error. -Stuart On Feb 11, 2009, at 4:56 PM, Stuart wrote: curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/ xml")); Drop the above line and I reckon it should work. The content you're sending is not XML, it's form fields which CURL will default to. It just happens that one of those fields is XML. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best way to post XML via curl?
This line is the key. WITH the line, I get a properly formatted XML response from the server, telling me that I did not send any valid post fields. WITHOUT the line, all I get back from the server is a '1' and their tech reports that no valid call was received from me. On Feb 11, 2009, at 4:56 PM, Stuart wrote: curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/ xml")); Drop the above line and I reckon it should work. The content you're sending is not XML, it's form fields which CURL will default to. It just happens that one of those fields is XML. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best way to post XML via curl?
Just realized I didn't happen to mention the problem. :-) The server is not seeing any of my posted fields. It's returning a properly-formatted XML response that says I did not submit the required fields. Unfortunately the server is a black box, but lots of other partners use it every day and supposedly there are no problems server side. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Best way to post XML via curl?
I'm going crazy, can't quite get this encoding to work. I've tried all the various combinations, trying to send this block $xml (which is a simple string variable) via post along with 3 other params: $postArgs = http_build_query(array('method'=>'newPrintRequest', 'login'=>$login, 'password'=>$password, 'orderxml'=>$xml)); $ch = curl_init('http://test.server.com/rest_interface.php'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $postArgs); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml")); $response = curl_exec($ch); Is this use of http_build_query the best way to send XML? Any other curl options I should be setting? I tried urlencoding() the $xml, I tried htmlspecialchars(), I tried nothing at all, I tried & and & is there a "best practice" for how a big block of xml should be posted? :-( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert CMYK values to RGB values?
I think your short answer is the right one. This explains why I didn't find that cmyk_to_rgb() function on php.net. Thanks... :-( On Jan 9, 2009, at 3:14 PM, c...@l-i-e.com wrote: Short Answer: You can't. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Convert CMYK values to RGB values?
Anyone know how to convert CMYK values to RGB values? I'm just trying to translate the numbers from one to the other, not actually do any graphic stuff. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imagejpeg, imagecreatefromjpeg both choke
Same thing, no output at all. I can access the image directly in my browser and it's fine. On Jan 9, 2009, at 7:52 AM, Zechim wrote: try, header('Content-type: image/jpeg'); $image = imagecreatefromjpeg($your_file); imagejpeg($image,"", 100); imagedestroy($image); zechim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] imagejpeg, imagecreatefromjpeg both choke
I'm trying a stripped down test just to try to get this work. I have a valid jpeg on disk: 3.jpg<- 3316x2220, 3.6 MB And am trying either of the following: // This does nothing at all imagejpeg('3.jpg'); // This displays "failed" $im = imagecreatefromjpeg('3.jpg'); if(!$im) echo 'failed'; phpinfo() shows GD enabled, JPEG functions enabled, memory_limit at 256M, permissions on the file and the enclosing folder are 777. Any suggestions what else I can try to debug this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How can a script tell if there's a MySQL problem?
I have one server that's pretty busy and runs into "Too many connections" from MySQL from time to time, and needs to have MySQL restarted to clear it up. I've tried everything I can think of to have PHP take note of this error but continue executing with other stuff, but no matter what I try the PHP script stops whenever it encounters this and just displays "Too many connections." Anyone know if there's a way for PHP to gracefully detect this and resume operation without choking? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Anyone else have trouble with Apple Mail threading this list?
I use Apple Mail, and subscribe to many lists but PHP-General is the only one I have this problem with. People tell me that my replies are not properly threaded to the original post. When I hit Reply or Reply All in Mail, it wants to reply directly to the poster, and only CC's the list. So I drag the CC address up to the To field and delete the poster's address. Seems like the best I can do, but it creates this problem people have reported. Do I just totally suck, or is there a more reasonable explanation? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IM Convert PDF->JPG works in command line, not in PHP
OMG. I had not set the permissions properly on the destination directory. It works now. Sorry for wasting the list's time, and thanks to Chris for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IM Convert PDF->JPG works in command line, not in PHP
Interesting. When I try this, $return_output gives an empty array, and $return_code gives 1. On Dec 31, 2008, at 3:38 PM, chris smith wrote: Try using exec() so you get the whole return message, might be something useful in there. exec($command_line, $return_output, $return_code); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IM Convert PDF->JPG works in command line, not in PHP
My typo skipping the '/html/' in the pathname, the paths are correct in my actual code. On Dec 31, 2008, at 3:24 PM, Brian Dunning wrote: /var/www/html/original.pdf /var/www/html/new.jpg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] IM Convert PDF->JPG works in command line, not in PHP
Here's a weird thing. I have a new Redhat machine, with PHP 5.2.6 and IM 6.4.8. The following works beautifully on the command line: convert original.pdf new.jpg But from PHP, it only works beautifully if I specify complete pathnames for convert, the original file, and the new file (that's OK, no problem), but it only works converting JPG and GIF images. As soon as I try to convert a PDF image, it fails: $command_line = "/usr/local/imagemagick/bin/convert /var/www/html/ original.pdf /var/www/new.jpg"; system($command_line, $return_var); ?> $return_var = 1. I don't have ghostscript, but I figured I don't need it since the PDF->JPG conversions works on the command line. Any suggestions? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help debugging a file upload on IIS
The one thing I was doing was: move_uploaded_file($_FILES['upload_file']['tmp_name'], $new_path); but nothing was happening, no new file appearing where it was supposed to, and no error returned, left me scratching my head. (Later the same script logs the upload to MySQL using data from $_FILES and that part works fine.) On Dec 29, 2008, at 12:43 PM, Ashley Sheridan wrote: Sorry, that's a silly question, ignore that. As far as I'm aware, IIS removes the files once the script has run it's course; so unless you're doing something with the file in your code, you won't really see it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help debugging a file upload on IIS
Hi - I have a file upload that returns no error, but the file does not appear on the server. Here is the result of $_FILES: Array ( [f] => Array ( [name] => Elephants.pdf [type] => application/pdf [tmp_name] => C:\WINDOWS\Temp\php3133.tmp [error] => 0 [size] => 114109 ) ) Nothing new at all in C:\Windows\Temp\. PHP is properly putting its session files in there, so I know PHP has permission. Anyway I set Everyone permissions to Full Control for that directory. post_max_size and upload_max_filesize are both 250M. Just not sure what else to check. PHP 5.2.6, Microsoft-IIS/6.0, Windows 2003 Server R2, Enterprise Edition, SP2 Thanks.
Re: [PHP] Can GD make a JPG thumbnail of a PDF?
I've spent most of the last week trying to get ImageMagick working on my Windows PHP installation. I gather that since I'm going to be converting PDFs to JPEGs, I need Ghostscript. Well, I've got ImageMagick installed: http://printhq2.com/info.php I ran a Ghostscript installer, but it didn't seem to do very much. Some site advised me to test my installation like this: "; system("convert -version"); echo ""; ?> But it just returns blank. Can anyone help me get ImageMagick working on my server? On Nov 20, 2008, at 4:41 PM, Stephen Johnson wrote: No but you can use imagemagicks convert to convert the pdf to an image and then make a thumbnail of it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Slow file download
IIS, Windows PHP 5.2.6, and unfortunately the downloads are https. On Dec 2, 2008, at 12:32 PM, Nathan Rixham wrote: what's the server running? iis/apache, win/linux version of php (as accurate as you can) oh and via http or https/ssl? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Slow file download
I'm open to something like that - we're in the middle of the holiday crunch and can't afford any downtime, so a significant change is out of the question. This is part of much larger and more involved scripting, so it would need to be a plug-n-play replacement and also be able to return information to the script calling it - bytes, success or failure. We're grabbing filenames and credentials out of MySQL, marking them "in progress", attempting the download, and then updating the MySQL record with the results. On Dec 2, 2008, at 12:04 PM, Ashley Sheridan wrote: Instead of using PHP for this, why not have a look at WGET for Windows. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Slow file download
I'm using a PHP cron job to constantly download files from a remote server. Client and server both have abundant unused bandwidth, and the sysads have already eliminated switches, interface cards, etc. as the source of the slowdown. I'm looking at the script to see why file downloads are taking so long and going so much slower than if I were to simply manually download them with a browser on the same machine. The script says: $ctx = stream_context_create(array('http' => array('timeout' => 1200))); // 20 minutes per file $contents = file_get_contents($full_url, 0, $ctx); $fp = fopen('D:\\DocShare\\'.$filename, "w"); $bytes_written = fwrite($fp, $contents); fclose($fp); Yes, it's on Windows. Any idea whether my PHP code might be introducing a slowdown? The files range from 500K to 50MB. I often launch multiple instances of the script but it doesn't seem to help much. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Anyway to simulate pcntl_fork() on Windows?
It's the function I need most and it's not available on Windows, and unfortunately that's what the client uses. Any suggestions for a workaround? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can GD make a JPG thumbnail of a PDF?
Well can it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Launching multiple PHP threads via Scheduled Tasks
I've got a script that downloads files queued from a server, and it's launched by a Windows Scheduled Task that launches every minute. My understanding of the default behavior is that if the task is still running a minute later when it's time to launch again, a duplicate thread will not be launched. The remote server administrator wants me to launch multiple threads all day - in my mind the wrong choice, since multiple download threads slow everyone one, but that's what he wants. Anyone know if there's a way to make Windows Scheduled Task launch a new thread of the PHP script, regardless of whether it's already running? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Timing problem, putting PNG into PDF
I'm using GD to crop & save an uploaded image, and then embedding it into a PDF made with FPDI. It works great when the image is small or low-res. When the uploaded file is bigger, more than a couple hundred K or so, it fails. I think that the image is not done writing yet by the time I try to do the $pdf->Image. Any suggestions? Some way to force it to hang out and pause until the image is done writing? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Splitting up long URLs
I have a web page that lists "most recent comments" in a left margin. Sometimes people post long URLs, or even just really really long words, that force that margin to display way too wide, screwing up the page layout. Is there a way to make sure URLs or other text in a string gets split up so this doesn't happen? If there's a CSS solution that's better than a PHP solution I'll take that too. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Simple array problem
I'm trying to add a number to a value in an array. Pretend I have this: $new_value = array('orange', 2); $arr = array( array('blue', 4), array('orange', 5), array('green', 6)); I want to add the new value to the existing matching array element, so I end up with this: $arr = array( array('blue', 4), array('orange', 7), array('green', 6)); Seems like it should be really simple but all the ways I can figure out to do it are too kludgey. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php