any body know about bookmarklet using fsocketopen in firefox

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
naeembhatti
Forum Newbie
Posts: 3
Joined: Thu Jan 05, 2006 6:11 am

any body know about bookmarklet using fsocketopen in firefox

Post 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]
User avatar
Mordred
DevNet Resident
Posts: 1579
Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria

Post 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.
naeembhatti
Forum Newbie
Posts: 3
Joined: Thu Jan 05, 2006 6:11 am

so what should i do

Post 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.
Post Reply