Page 1 of 1

any body know about bookmarklet using fsocketopen in firefox

Posted: Wed Sep 20, 2006 2:52 am
by naeembhatti
Weirdan | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


i want to get the images from other sites like
http://www.php.net/manual/en/function.fsockopen.php

Code: Select all

$hots='http://wwww.yahoo.com';
	
		$fp = fsockopen($host, 80, $errno, $errstr, 30);
		if (!$fp) {
		   echo "$errstr ($errno)<br />\n";
		} else {
		   $out = "GET / HTTP/1.1\r\n";
		   $out .= "Host: ".$uri."\r\n";
		   $out .= "Connection: Close\r\n\r\n";
		
		   fwrite($fp, $out);
		   while (!feof($fp)) {
			echo = fgets($fp, 128);
		   }
		   fclose($fp);
		}
the prb is this that this code does not work for this site i don't know why
http://www.canadiantire.ca/assortments/product_detail.jsp...


Weirdan | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Wed Sep 20, 2006 5:24 am
by Mordred
1. This is not a bookmarklet, this is php code.
2. The code itself is wrong - $hots instead of $host, no defined $uri, and the HTTP request is wrong, as it will only get the main page.
3. It is quite probable that you're not sure yourself how to do what you want, so the best practice would be to explain what you want first.
4. The example site wants some form of "Login" which means that most probably you have to handle cookies as well (if HTTP is what you really need, which I frankly doubt)

Google search for bookmarklets and rfc2616 for details.

so what should i do

Posted: Wed Sep 20, 2006 8:07 am
by naeembhatti
currently i am using a snoopy class to fecth images and records form other sites
but i still don't know why this site is not working using snoopy class
?
http://sourceforge.net/forum/message.php?msg_id=3918765
if u need i can also post my example code here

please help me out.