0

I am working on a data scraping project and I need to extract some data from the script tag inside a html page

<script type="text/javascript">
jQuery(document).ready( function(){
    new Equator.dataTable.loadEQDataTable( '33F6AC0950569B89A6D81D719B651143', '/proxy/ajaxproxy.cfc?method=process&event=property.getWorkflowByTask&marshalType=dataTable&sListColumns=EVENT_NAME,ADDRESS_1,CITY,STATE,POSTAL_CODE,status_value,ROLE_DISPLAY,LENDERNAME,OPEN_DATE,DUEDATE&nTargetID=17801&nIsOpen=2&sEventType=form,form_html,rfi', '9', 'asc', 'true', 'true', 'index.cfm?event=property.getWorkflowByTask&sListColumns=EVENT_NAME,ADDRESS_1,CITY,STATE,POSTAL_CODE,status_value,ROLE_DISPLAY,LENDERNAME,OPEN_DATE,DUEDATE&sListLabels=Task,Address,City,State,Zip,Status,Role,Servicer,Opened,Due/Completed&sListExcelColumns=EVENT_NAME,ADDRESS_1,CITY,STATE,POSTAL_CODE,status_value,ROLE_DISPLAY,LENDERNAME,OPEN_DATE,DUEDATE&sListExcelLabels=Task,Address,City,State,Zip,Status,Role,Servicer,Opened,Due/Completed&bExcel=true&nTargetID=17801&nIsOpen=2&sEventType=form,form_html,rfi&iSortCol_0=9&sSortDir_0=asc', '', '25', 'false', '',false, true, '');
    });
</script>

In which I need to extract

/proxy/ajaxproxy.cfc?method=process&event=property.getWorkflowByTask&marshalType=dataTable&sListColumns=EVENT_NAME,ADDRESS_1,CITY,STATE,POSTAL_CODE,status_value,ROLE_DISPLAY,LENDERNAME,OPEN_DATE,DUEDATE&nTargetID=17801&nIsOpen=2&sEventType=form,form_html,rfi', '9', 'asc', 'true', 'true', 'index.cfm?event=property.getWorkflowByTask&sListColumns=EVENT_NAME,ADDRESS_1,CITY,STATE,POSTAL_CODE,status_value,ROLE_DISPLAY,LENDERNAME,OPEN_DATE,DUEDATE&sListLabels=Task,Address,City,State,Zip,Status,Role,Servicer,Opened,Due/Completed&sListExcelColumns=EVENT_NAME,ADDRESS_1,CITY,STATE,POSTAL_CODE,status_value,ROLE_DISPLAY,LENDERNAME,OPEN_DATE,DUEDATE&sListExcelLabels=Task,Address,City,State,Zip,Status,Role,Servicer,Opened,Due/Completed&bExcel=true&nTargetID=17801&nIsOpen=2&sEventType=form,form_html,rfi&iSortCol_0=9&sSortDir_0=asc

1 Answer 1

1

You can get the second parameter with:

preg_match_all("/'(.*?)'/", $script, $m);
echo $m[1][1];
Sign up to request clarification or add additional context in comments.

2 Comments

But also like to know is there a way to extract that particular line alone and do this. Because now I am getting all the parameters with in braces and when the other content of the site changes and if the number of braces change then the array index would change do you got any solution for this. Like extracting that line and getting the parameters.
I suppose you would just be more specific with the regex.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.