NameSilo

Curl To Grab URL

SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
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
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
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
Close
Thanks for the note...

Is it possible to display the contents?
 
0
Close
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
Close
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
Close
CatchedCatched

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Filters for activity feeds
Your news feed, Latest activity, and the activity tab on profiles now have filter buttons: All, Posts, Quick replies, and Other. Your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back