NameSilo

Curl To Grab URL

Spaceship Spaceship
Watch

newsiness

VIP Member
Impact
49
Code:
<?php

// create a new curl resource
$ch = curl_init();

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://www.llmtrafik.gov.my/showtraffic.aspx?hw=PNB");

// grab URL and pass it to the browser
curl_exec($ch);

// close curl resource, and free up system resources
curl_close($ch);

?>

I am using curl to grab the contents from url llmtrafik.gov.my/showtraffic.aspx?hw=PNB as an example.
Some of the contents (please ignore the images) especially under "Traffic Events" are not displayed by using curl script. Any idea? Please advice. :)

Thanks!!!
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable DomainsUnstoppable Domains
it is populated by javascript.

1 disturbing thing I found was the following in the source as well:-

Code:
		<script language="javascript">
			var url = window.location.href;
			if (url.indexOf('/showtraffic.aspx?') >= 0)
				//alert(url.indexOf('/showtraffic.aspx?'))
			else
				document.getElementById('DataGrid2').outerHTML = "[B]I want to f**k you! F**k you! :D[/B]";
		</script>

I have slightly edited the words but you can obviously see wht they are.

Should a government website have such things within it's source.
 
0
•••
Thanks for the note...

Is it possible to display the contents?
 
0
•••
newsiness said:
Thanks for the note...

Is it possible to display the contents?
PHP:
$response = curl_exec($ch);
The variable will contain the HTML source code of the remote page
 
0
•••
Kath said:
PHP:
$response = curl_exec($ch);
The variable will contain the HTML source code of the remote page


Did you actually read the thread or look on the page. The content he is after is displayed from javascript after the page loads.
 
0
•••
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back