Uncaught Error: Call to a member function find() on string in C:\xampp\htdocs\dom\curldom.php:22 Stack trace: #0 {main} thrown in C:\xampp\htdocs\dom\curldom.php on line 22nicht erfasste Fehler: Rufen Sie auf eine Elementfunktion find() auf Zeichenfolge in PHP DOM kräuseln
geben diesen Fehler
<?php
include('simple_html_dom.php');
function getCode($url)
{
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch, CURLOPT_REFERER, 'https://www.google.com/');
$output = curl_exec($ch);
curl_close($ch);
$html = file_get_contents($output);
//return $output;
}
$url = 'http://www.amazon.in/Honor-6X-Grey-64GB/dp/B01LWZ14Z2/ref=sr_1_1?s=electronics&ie=UTF8&qid=1494825701&sr=1-1&keywords=honor+6x';
$varc = getCode($url);
$cost = $varc->find('span[id=priceblock_saleprice]');
// $price ='/<span id="priceblock_saleprice">/';
// preg_match_all($price,$varc,$cost);
echo $cost;
?>
Funktion finden nicht existiert. Auch das ist keine Klasse. Sie können nicht auf Funktionen wie diese zugreifen, wenn es sich nicht um eine PHP-Klasse handelt. – Akintunde007
lol ...... // return $ output; Kommentar auf diese Zeile entfernen –
Ich habe bereits tthat immer noch nicht funktioniert @BilalAhmed –