php-general Digest 29 Nov 2011 02:21:55 -0000 Issue 7589
Topics (messages 315854 through 315860):
Re: PHP exercises
315854 by: shiplu
curl ,response headers and gzip encoding
315855 by: Tontonq Tontonq
Re: Finding and reading firefox bookmarks with PHP
315856 by: David McGlone
snippets google plus with wordpress
315857 by: ml
315858 by: Ashley Sheridan
PHPExcel
315859 by: Floyd Resler
PHP run from console - automatic password input
315860 by: asdf zxcv
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
Here is a good place for logic building.
http://projecteuler.net/
--
Shiplu Mokadd.im
Innovation distinguishes between follower and leader
--- End Message ---
--- Begin Message ---
hi i am trying to build a proxy server for opera's turbo mod
<?
error_reporting(0);
$domain='http://
'.@substr($_SERVER['REQUEST_URI'],strlen($_SERVER['SCRIPT_NAME'])+1);
$data=$_SERVER['REQUEST_METHOD'].' '.$domain;$data=$data.' HTTP/1.1';
$domainadi=@parse_url($domain) or die('Hata Kod :
4');$domainadi=$domainadi['host'];
if(empty($domain)) { die('Hata Kod : 4'); }
foreach (getallheaders() as $name => $value) {
$data.= "\n$name: $value";
}
$data=str_replace('Host: w.com','Host: '.$domainadi,$data);
$data.="\r\n\r\n";
if($_SERVER['REQUEST_METHOD']=='POST') {
$data.=@file_get_contents('php://input'); }
#echo $domain;exit;
#echo $data;exit;
$ch = curl_init($domain);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if($_SERVER['REQUEST_METHOD']=='POST') { curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, @file_get_contents('php://input')); }
$header = array();
foreach(getallheaders() as $key => $value)
{
if(strtolower($key)!='host')
{
$header[] = $key . ':' . $value;
}
}
curl_setopt($ch , CURLOPT_HTTPHEADER , $header);
$donen=@curl_exec($ch);
#header('Content-Encoding: gzip');
if(curl_getinfo($ch,CURLINFO_HTTP_CODE)=='0') die('Hata Kod:36');
@list($reshead, $body) = @explode("\r\n\r\n", $donen, 2) or die('Hata Kod
:37');
$info = curl_getinfo($ch);
$reshead = substr($donen, 0, $info['header_size']);
$body = substr($donen, $info['header_size']);
$headerlar=explode("\n",$reshead);
for($i=0;$i<count($headerlar);$i++)
{
header(trim($headerlar[$i]));
}
header('X-Opera-Host: v07-16:12419');header('X-Opera-Info:
ID=2');header('X-OA:
8ebe63c71408d41bfa10d4fef52ea7bb961b2d22cf6cb823d1845f2be63e1950');
echo $body;
curl_close($ch);
?>
it returns the gzip content as damaged may be for split the headers and
body ,
,
when i take curl_setopt($ch, CURLOPT_HEADER, 0); to curl_setopt($ch,
CURLOPT_HEADER, 1);
header('Content-Encoding: gzip'); uncomment this line
hide these lines
/*
if(curl_getinfo($ch,CURLINFO_HTTP_CODE)=='0') die('Hata Kod:36');
@list($reshead, $body) = @explode("\r\n\r\n", $donen, 2) or die('Hata Kod
:37');
$info = curl_getinfo($ch);
$reshead = substr($donen, 0, $info['header_size']);
$body = substr($donen, $info['header_size']);
$headerlar=explode("\n",$reshead);
for($i=0;$i<count($headerlar);$i++)
{
header(trim($headerlar[$i]));
}
*/
and return the original content echo $donen; curl_close($ch);
it works nice,
but i cant forward the headers to client :( and not sure why the original
scripts returns the gzip content as damaged :/
--- End Message ---
--- Begin Message ---
On Sun, 2011-11-27 at 22:20 -0500, Paul M Foster wrote:
> On Sun, Nov 27, 2011 at 06:47:36PM -0500, David McGlone wrote:
>
> > Hi all, I am wondering if it's possible to find the bookmarks file in
> > firefox and output the contents on a page with PHP.. I'm wanting to do
> > this so I can use it as my home page.
>
> The answer to this is not in PHP; it can be done in Firefox by itself.
> It's been a long time since I set this up, but if I'm not mistaken, the
> procedure goes like this:
>
> 1. In Firefox, enter about:config in the URL bar. (Ignore warnings.)
> 2. You are now in the raw configs. Search for a key called
> browser.bookmarks.autoExportHTML. Set this to 2. This should cause
> Firefox to dump the contents of it places.sqlite file to a file called
> bookmarks.html when Firefox is closed.
> 3. Find another key called browser.startup.homepage. Set this to the
> absolute path of a file called bookmarks.html in your Firefox file tree.
> The path will be something like (in Linux):
> /home/<username>/.mozilla/firefox/<random string>.default/bookmarks.html.
> (Obviously, you'll have to locate this file ahead of time.)
>
> If this isn't the exact procedure, it's close. You can dig into the
> Firefox docs to get the exact values or keys if these aren't right. (For
> example, I don't know why the first key I mentioned is 2 instead of 1.)
>
> Anyway, I have my Firefox set up this way.
Hi Paul. The drawback I have found so far with this setup is that the
page will not update until firefox is restarted. do you have a
workaround for this?
--
Thanks,
David M.
--- End Message ---
--- Begin Message ---
Hello list
hello php
hello bearded
I just finished partially implement the google snippets about wordpress
I say partially
Indeed j arrives to recover as the author and date
No I can not seem to recover to recover the image and description of
the subject
Here is the code that uses the j page themes index.php page.php
single.php
<div itemscope itemtype="http://schema.org/Article">
<h3 itemprop="name"><?php the_title(); ?></h3>
<img itemprop="image" src="<?php echo
get_the_post_thumbnail($page->ID, 't\
humbnail'); ?></img>
<p itemprop="description"><?php the_title();echo (" "); ?><?php
the_author\
(); ?> <?php the_time( get_option( 'date_format' )); ?></p>
</div>
I get the title the author el date
how to properly run the snippets
I thank you for your help our
--
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x092164A7
gpg --keyserver pgp.mit.edu --recv-key 092164A7
http://urlshort.eu fakessh @
http://gplus.to/fakessh
http://gplus.to/john.swilting
--- End Message ---
--- Begin Message ---
On Mon, 2011-11-28 at 21:32 +0100, ml wrote:
> Hello list
> hello php
> hello bearded
>
> I just finished partially implement the google snippets about wordpress
>
> I say partially
> Indeed j arrives to recover as the author and date
> No I can not seem to recover to recover the image and description of
> the subject
>
> Here is the code that uses the j page themes index.php page.php
> single.php
>
> <div itemscope itemtype="http://schema.org/Article">
> <h3 itemprop="name"><?php the_title(); ?></h3>
> <img itemprop="image" src="<?php echo
> get_the_post_thumbnail($page->ID, 't\
> humbnail'); ?></img>
> <p itemprop="description"><?php the_title();echo (" "); ?><?php
> the_author\
> (); ?> <?php the_time( get_option( 'date_format' )); ?></p>
> </div>
>
> I get the title the author el date
>
> how to properly run the snippets
> I thank you for your help our
>
> --
> http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x092164A7
> gpg --keyserver pgp.mit.edu --recv-key 092164A7
>
> http://urlshort.eu fakessh @
> http://gplus.to/fakessh
> http://gplus.to/john.swilting
>
I think for questions specific to Wordpress you really ought to ask on a
Wordpress list/forum. This one is for general questions about PHP, not
really the best place to ask specifics about a particular CMS. There's a
list of the forums available at http://wordpress.org/support/
--
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
Does anyone have much experience with PHPExcel? I'm having difficulties in
getting multiple sheet workbooks to work properly. I haven't been able to find
any practical examples.
Thanks!
Floyd
--- End Message ---
--- Begin Message ---
I'm trying to make my php script (run from console) to input nesesary data
when console asks for it.
For example, i want to automatically manage revoking self-signed
certificates, but when i exec("command") then system asks me to give the
pass phrase. I dont want to do that. Instead, I want my script to input the
password automatically.
Is there any way to achieve that?
Regards
Peter
--- End Message ---