Questions tagged [php-parser]

73 questions
2
votes
4 answers

Parse Web Page content using PHP

I think it's simple question but I've done what I know and still not work. I want get output from this link :…
andrefadila
  • 647
  • 2
  • 9
  • 36
2
votes
2 answers

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

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:

Hello

ABC
crossRT
  • 616
  • 4
  • 12
  • 26
1
vote
0 answers

Need help invoking a rust library with Typescript in Tauri

In my project I want to analyze the source code of a PHP file and convert it to AST. There is already a javascript package for this, but it only works with node. So I tried to convert the PHP code to AST using a Rust library. However, I have no…
1
vote
1 answer

Regex to match a result that isn't single line and expanded across multiple lines

I want to change /<\?php\s([\s\S]*?)\?>/gi the way that single line PHP tags become excluded. For example, here I want to match only second PHP tag and not the first one: Test number is here. This is test number
1
vote
1 answer

Modify an array variable inside php file with Nikic PhpParser [php]

In the first.php file, I assigned some variables and defined some constant values, define("CONSTANT1", "cons1value"); $variable1 = "var1value"; $variable2 = array( "key1" => "value1", "key2" => "value2" ); I need to change values through…
1
vote
1 answer

Finding Content from Javascript using Simple HTML DOM Parser

How do I find the content "Please enter a valid key again" using Simple HTML DOM Parser? Example: This don't seem to…
user622378
  • 2,318
  • 6
  • 42
  • 63
1
vote
1 answer

How to hide attributes in PHP-Parser

I'm using PHP-Parser to parse PHP codes, and get the AST in Json format. I want to ask how to get the results without Attributes ( startLine, endLine, comment etc.)
1
vote
1 answer

having trouble parsing an array in php

Just starting with php and sorry if this is a newbie question but i'm having problems parsing a array. I get this value(output of print_r($result);): Array ( [0] => stdClass Object ( [Master_companyname] => Royal Bank of Canada …
Lostsoul
  • 25,013
  • 48
  • 144
  • 239
1
vote
2 answers

How to avoid php parsing the whole php file and includes and make it only parse what will be used?

I read somewhere that php parses the whole .php file every time it is executed. Some solution was proposed in there (that was not opcache), but I lost the website and I couldn't find it. Now I have an enormous php website that has many long…
algo
  • 108
  • 1
  • 11
1
vote
1 answer

Limit echo of variable in PHP to get the desired characters

$response var has a component called custom_test_name which looks like below: [Test_Name]ad.no.check1.check2.check3 and here is the small PHP code: "; ?> This prints…
Pratik Jaiswal
  • 309
  • 7
  • 26
1
vote
2 answers

CSS thru PHP Parser vs. PHP as CSS source

To have my project respond to certain contexts of content, I want my CSS files to respond respectively instead of setting up additional CSS files (adds to http requests) or parsing the CSS right inside the respective php script (imho: quite messy).…
Amanahumpa
  • 55
  • 12
1
vote
1 answer

Two Levels of namespaces in XML parsing with PHP

I have been trying to parse the the title and description from the following XML document (this is just the top part). I have found lots of information about dealing with namespaces but I cannot figure out how to deal with a situation involving…
Bren
  • 3,516
  • 11
  • 41
  • 73
1
vote
1 answer

Opening a link in a div with PHP

I am building a site that parses a spanish dictionary. If you look up the word HOLA, you will receive the definition, but for other words, you get suggestions, like CASA: http://verbum.xtrweb.com/verbumpost.php?word0=hola&word-1=casa I wish to: when…
1
vote
1 answer

How can I remove all tags except an allowed list from html parsed by php

I am parsing html in php and as I have no control over the original content I want to strip it of styling and unnecessary tags while still keep the content and a short list of tags, namely: p, img, iframe (and maybe a couple of others) I know I can…
Finglish
  • 9,692
  • 14
  • 70
  • 114