Note that there are some explanatory texts on larger screens.

plurals
  1. POCraigslist, CURL, Simple PHP DOM Issues
    text
    copied!<p>I am logging into Craigslist with CURL to scrape the status of my posted listings. The problem I encounter is the transfer of HTML from CURL $output to file_get_html. While Craigslist statuses are actually nested inside TR elements, I just wanted to test the most basic functions to see if things were getting passed through (i.e. link scraping). They are not.</p> <p>For example, this doesn't work:</p> <pre><code>$cookie_file_path = getcwd()."/cookie.txt"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://accounts.craigslist.org/login?LoginType=L&amp;step=confirmation&amp;originalURI=%2Flogin&amp;rt=&amp;rp=&amp;inputEmailHandle='.$email.'&amp;inputPassword='.$password.'&amp;submit=Log%20In'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_REFERER, 'http://www.craigslist.org'); $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)"; curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path); $output = curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); echo $output; // include_once('simple_html_dom.php'); $html = file_get_html($output); //find all links foreach($html-&gt;find('a') as $element) echo $element-&gt;href . '&lt;br&gt;'; </code></pre> <p>I know the expression works because it returns links if I put in '<a href="http://google.com" rel="nofollow noreferrer">http://google.com</a>', or something or other. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload