php-parser

How to use PHP-Parser to get the global variables name and change it

醉酒当歌 提交于 2020-06-08 19:37:38
问题 I want to use PHP-Parser library to get the global method ( _POST, _GET, _REQUEST ) to get values in PHP. I'm using PHP-Parser where I want to check the node name if it equal to ( _POST, _GET, _REQUEST ). I'm still beginner in PHP-Parser and not figure out how to get these global variables. For example, if I have the following source code: code: <?php $firstname = $_POST['firstname]; The PHP-parser I used until now looks like this: <?php require_once('vendor/autoload.php'); use PhpParser

Convert HTML table rows into PHP array and save it to database? [closed]

血红的双手。 提交于 2020-01-23 01:33:27
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I'm trying to save a html table rows into php array and then save the array in database. <form action="" method="post"> <table class=

Display xml file cascaded contents in a drop down via php

混江龙づ霸主 提交于 2020-01-16 10:12:41
问题 I have a local xml file which I am trying to display over a webpage with following code. All I get is a blank page. enter code here <?php $xml_content = file_get_contents("C:\Users\user\Downloads\93D7.xml"); $data = simplexml_load_string($xml_content); foreach ($data->item as $item) { var_dump($item->bookname); } ?> Once the display works, I want to have a drop down where I will select the xml element / entity and it will display the value or child of that element / entity. Can someone help?

Display xml file cascaded contents in a drop down via php

江枫思渺然 提交于 2020-01-16 10:12:20
问题 I have a local xml file which I am trying to display over a webpage with following code. All I get is a blank page. enter code here <?php $xml_content = file_get_contents("C:\Users\user\Downloads\93D7.xml"); $data = simplexml_load_string($xml_content); foreach ($data->item as $item) { var_dump($item->bookname); } ?> Once the display works, I want to have a drop down where I will select the xml element / entity and it will display the value or child of that element / entity. Can someone help?

PHP Simple HTML DOM Parser Call to a member function children() on a non-object

喜欢而已 提交于 2019-12-13 17:11:42
问题 I'm pretty new to PHP, so i try to use Simple HTML DOM Parser to get the information i need from a website. here is the sample node: <div> <h1>Hello</h1> <figure id="XXX"> <div class="abc">ABC</div> <div class="qwe">QWE</div> <div class="zxc">ZXC</div> </figure> </div> $element contain above node. What i need to get is the "QWE", so i try: $name = $element->find('figure[id=XXX]')->children(1)->innertext; but now the problem: Fatal error: Call to a member function children() on a non-object ,

Laravel 4 using nikic phpparser : Going out of memory when sending email

半世苍凉 提交于 2019-12-12 10:43:29
问题 Just learned that Laravel using nikic phpparser internally. I modified my code to sending emails on one of the conditions & it started dying. The PHP logs showed this : [Sat Oct 03 21:18:23 2015] [error] [client xx.xx.xx.xx] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 1048576 bytes) in /home/yyyy/public_html/vendor/nikic/php-parser/lib/PHPParser/NodeTraverser.php on line 66, referer: http://yyyy.com/home Temporarily I've increased the memory to resolve

HTML through PHP parser

穿精又带淫゛_ 提交于 2019-12-12 03:19:43
问题 I'm trying to hide the fact I'm using PHP on one of my site pages and I'm wanting to run it through the PHP parser (just that page not them all) so I can call it filename.html as usual. I have tried a few Apache directives I found online and have a few in my .htaccess file (hotlinks and for a 404 page). When i use one of the scripts (in my .htacess) for the PHP purpose, the page wants to be saved/downloaded (like a vcard does) and a box shows - with no page to view. Can anyone please help. I

Find PHP with REGEX

淺唱寂寞╮ 提交于 2019-12-12 01:35:06
问题 I need a REGEX that can find blocks of PHP code in a file. For example: <? print '<?xml version="1.0" encoding="UTF-8"?>';?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <?php echo "stuff"; ?> </head> <html> When parsed would by the REGEX would return: array( "<? print '<?xml version=\"1.0\" encoding="UTF-8"?>';?>", "<? echo \"stuff\"; ?>" ); You can assume the PHP

PHP- HTML parsing :: How can be taken charset value of webpage with simple html dom parser?

和自甴很熟 提交于 2019-12-11 04:00:58
问题 PHP:: How can be taken charset value of webpage with simple html dom parser (utf-8, windows-255, etc..)? remark: its have to be done with html dom parser http://simplehtmldom.sourceforge.net Example1 webpage charset input: <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> result:utf-8 Example2 webpage charset input: <meta content="text/html; charset=windows-255" http-equiv="Content-Type"> result:windows-255 Edit: I try this (but its not works): $html = file_get_html('http:/

Parse Web Page content using PHP

 ̄綄美尐妖づ 提交于 2019-12-10 23:39:13
问题 I think it's simple question but I've done what I know and still not work. I want get output from this link : http://api.microsofttranslator.com/V2/Ajax.svc/Translate?text=siapa+rektor+ipb&appId=58C40548A812ED699C35664525D8A8104D3006D2&from=id&to=en You can paste on the browser and look into it. There some text output. I've tried with some function in PHP like file_get_contents and curl. I'm not using ajax or JavaScript because I'm not expert with it. And the last, I'm working with XAMPP. 回答1