6 Replies - 212 Views - Last Post: 26 May 2020 - 06:02 AM Rate Topic: -----

#1 sayhello   User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 358
  • Joined: 12-November 17

parse-error with a 4 liner: unexpected syntax

Posted 25 May 2020 - 06:37 AM

hello dear experts, good day dear no2pencil, good day dar Artificalsoldiert, heollo dear Modi 1-2-3




with a little parser-script i am getting a error :: indeed: i get a parse-error with a 4 liner : unexpected syntax

<?php
require 'simple_html_dom.php';

$html = file_get_html('https://wordpress.org/plugins/wp-job-manager/');
$title = $html->find ("h1", class_="plugin-title").text];
$text = $html->find(class_="entry-meta").text];

echo $title->plaintext."<br>\n";
echo $texte->text;
?> 



i get back the following report:

PHP Parse error: syntax error, unexpected '=', expecting ')' in /workspace/Main.php on line 7



Background: for a list of meta-data of popular wordpress-plugins ( cf.


https://wordpress.or.../wp-job-manager
https://wordpress.or...ins/ninja-forms
https://wordpress.or...ipants-database

....and so on and so forth.

the method: so to take one page into consideration - fetching the meta-data of one Wordpress-plugin: With simple_html_dom (


see the source as an example:

Version: 1.9.5.12
installations: 10,000+
WordPress Version: 5.0 or higher
Tested up to: 5.4 PHP
Version: 5.6 or higher
Tags 3 Tags: database member sign-up form volunteer
Last updated: 19 hours ago
plugin-ratings 



Well at the moment i am trying to get the data for one plugin - if that runs well - then i want to loop over a certain amount of urls - beghinning with https://de.wordpress...browse/popular/



Any and all idea & help will be greatly appreciated.



Is This A Good Question/Topic? 0
  • +

Replies To: parse-error with a 4 liner: unexpected syntax

#2 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4275
  • View blog
  • Posts: 13,542
  • Joined: 08-June 10

Re: parse-error with a 4 liner: unexpected syntax

Posted 25 May 2020 - 06:51 AM

PHP constants (such as class_, resp. the string it may be converted into) are not writable.

This post has been edited by Dormilich: 25 May 2020 - 06:51 AM

Was This Post Helpful? 1
  • +
  • -

#3 sayhello   User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 358
  • Joined: 12-November 17

Re: parse-error with a 4 liner: unexpected syntax

Posted 25 May 2020 - 07:54 AM

good day dear Dormilich

many thanks for the quick reply. glad to hear from you. This is a annoying issue / error. I have to make clear why i get it.
You think that it has to do with a (not) writable "approach" that is inherited in the code - on line 6?
l look for it.

many many thanks dear Dormilich

have a great day
Was This Post Helpful? 0
  • +
  • -

#4 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4275
  • View blog
  • Posts: 13,542
  • Joined: 08-June 10

Re: parse-error with a 4 liner: unexpected syntax

Posted 25 May 2020 - 08:43 AM

I'd suspect missing quotes around the argument.
Was This Post Helpful? 1
  • +
  • -

#5 sayhello   User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 358
  • Joined: 12-November 17

Re: parse-error with a 4 liner: unexpected syntax

Posted 26 May 2020 - 02:42 AM

hello dear Dormilich, :bigsmile:


many thanks for your answer i am glad to hear from you again.

Dear Dormilich i thought: In the $title line, there is a space between find and the parentheses ()
well to be frank: - this may be a really problem. I think that i have to get rid of that extra space. This extra-space does not look okay.
i will erase it and have a closer look if it resolves the issues

furthermore: and you Dormilich reminded me of that: /(i am very glad): both of these lines are using "class_="

this is also not correct. i need to change it to "class="


Again Dormilich - many thanks for your help. You have made my day.


i am so glad to be part of this great place - the dreaimincode-forums.

keep up the superb place - it rocks!!

have a great day

say hello :bigsmile:
Was This Post Helpful? 0
  • +
  • -

#6 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4275
  • View blog
  • Posts: 13,542
  • Joined: 08-June 10

Re: parse-error with a 4 liner: unexpected syntax

Posted 26 May 2020 - 03:42 AM

Quote

In the $title line, there is a space between find and the parentheses () well to be frank: - this may be a really problem.

Nope. Most programming languages can deal with a bit of additional whitespace.
Was This Post Helpful? 1
  • +
  • -

#7 sayhello   User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 358
  • Joined: 12-November 17

Re: parse-error with a 4 liner: unexpected syntax

Posted 26 May 2020 - 06:02 AM

hi there good day dear Dormilich,


many thanks for the quick reply.

currently i am not at home - but later the evening i am at home. Then i will digg deeper and try to get the code working

i will come back and report all the findings. Meanwhile have a great day.


greetings
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1