I’m writing unit tests using an older version of PHPUnit (3.4) and thus can’t use all supported assertions listed in manual of 3.5 and 3.6. Though I could reengineer tests for instant support in my environment here, I’d like to make my tests dependent on current version of PHPUnit, so that i…
Tag: php
How can I detect the mime type with PHP when an actual file doesn’t exist?
Is there a way to detect the mime type of a file without actually having an actual file, for example when you’re generating the file and serving it as a download? I’m currently using file extension sniffing from here: http://www.php.net/manual/en/function.mime-content-type.php#87856 I was just won…
scraping website for info when the URL has product id’s instead of true values
Im guessing its php cURL, but Whats the best way to make a loop to scrape the DOM for info from a webpage that uses id’s in the URL Query like (?ProductId=103) There is about 1200 pages. I need to find the innerHTML of the 9th span on each page. This info will just get stored in a mySQL table
Paginate WordPress $wpdb Query?
I have this query: I’m using this because WordPress can’t properly order meta_values that uses numbers, anyway…everything works fine except I have no clue on how to paginate this using wp_pagenavi. Any idea? Answer Although I wouldn’t recommend it, you could try changing the properties…
PHP – Split code into multiple files or keep it in as few files as possible? [closed]
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 1 year ago. The community reviewed whether to reopen this question 7 months ago and left it closed: Orig…
Convert SVG image to PNG with PHP
I’m working on a web project that involves a dynamically generated map of the US coloring different states based on a set of data. This SVG file gives me a good blank map of the US and is very easy …
Merge PDF files with PHP [closed]
My concept is – there are 10 pdf files in a website. User can select some pdf files and then select merge to create a single pdf file which contains the selected pages. How can i do this with php?
How can I get today’s timestamp in PHP
I tried but when I output it I still get the time eg “22 Jan 2011 4:53:59 pm”. Why is that? UPDATE Ah… many people misunderstood me, my bad, I forgot to point out the main point. I created the date with just the date portion, I don’t want the time. So I’d expect something like An…
PHP — Convert milliseconds to Hours : Minutes : Seconds.fractional
I’ve got a script that takes in a value in seconds (to 2 decimal points of fractional seconds): I then convert it to milliseconds: And then I want to format it like so: Where ‘x’ is the fraction of the second (however many places after the decimal there are). Any help? I can’t seem to …
Write Post data to file with PHP
I need to post data using the code below, to php file that will save it in a text file. I just don’t know how to create the php file to receive the data below and save it in a text file. as simple as possible. Answer Simple as: