Run "onclick" through PHP
<pre><code>&lt;a href="#" onclick="return purchaseEntry('39873');"&gt;ABC&lt;/a&gt;
</code></pre>

<p>I'm planning to crawl to a web page and fetch certain contents using regex. However, this content only shows up after onclick is activated. I need to get into ABC and fetch the content. I can't use <code>file_get_content()</code> because there is no link takes me to ABC page. ABC content shows up when user clicks it. Results are called via Javascript/Ajax/Json.</p>

<p>ABC contents are:</p>

<pre><code>Name: XXXX
Address: XXXXXX
</code></pre>

<p>Any idea how to crawl to ABC and fetch the content?</p>

<p><strong>Note: I will have to write a PHP script that crawls into remote page and fetch ABC content.</strong></p>

<p>Extra info:</p>

<pre><code>function purchaseEntry(customerid) {
    $('customeridfield').value = customerid;
    if (approvedAgents()) {
        e1 = $('entrylisttable');
        e1.hide();
        getExistingDetails(customerid, 'confirmstatusexistingdetails');
        $('confirmstatushajjlicenceno').value = '';
        $('confirmstatusapproved').checked = false;
        e1 = $('confirmstatus');
        e1.show();
    }

    return false;
}
</code></pre>

<p>Also here is getExistingDetails:</p>

<pre><code>function getExistingDetails(customerid, existingdetails) {
    e1 = $(existingdetails);
    e1.innerHTML = 'Loading ... &lt;img src="/jpg/ajaxloader.gif" /&gt;';

    var url = '/samex/index.php';
    var pars = 'option=com_directory&amp;view=entry2&amp;customerid=' + customerid + '&amp;format=raw';
    new Ajax.Request(url, { method: 'get', parameters: pars,
        onSuccess: function(request) {
            var json = request.responseText.evalJSON();
            jsondata = json['data'];
            e1 = $(existingdetails);
            e1.innerHTML = jsondata['clientdata'];
        },
        onFailure: function(request) {
            e1 = $(existingdetails);
            e1.innerHTML = 'Unable to get information for customer ' + customerid;
        }
        });
}
</code></pre>

<p>Any suggestions?</p>
