Login To InderWeb ! Just Play !

Username:
Password:

UserSubmittedComments

CURL

304 code in response not modified

10.3.5 304 Not Modified

If the client has performed a conditional GET request and access is
allowed, but the document has not been modified, the server SHOULD
respond with this status code. The 304 response MUST NOT contain a
message-body, and thus is always terminated by the first empty line
after the header fields.

The response MUST include the following header fields:

response codes from server

In coding often we have to check for ststus of any link and given site.We may need this in CURl or ajax mostely.We have following codes which indicate different ststus from server.

[Informational 1xx]
100="Continue"
101="Switching Protocols"

[Successful 2xx]
200="OK"
201="Created"
202="Accepted"
203="Non-Authoritative Information"
204="No Content"
205="Reset Content"
206="Partial Content"

[Redirection 3xx]
300="Multiple Choices"
301="Moved Permanently"
302="Found"
303="See Other"
304="Not Modified"
305="Use Proxy"
306="(Unused)"
307="Temporary Redirect"

Get remote image file from another server saved into your server using CURL

Below is the code that was used for getting image from a remote location and saving that image to current folder.This code can be modified easily to achive something different.


<?php
/**
* @desc file: This source was used for copying images from another server to our own server and can be modified according to requirements.
*/
//***********************URL of image which you need**************
$img_url='http://www.inderweb.com/inderweb/userpictures/picture-1.jpg';
$ext_arr=explode("/",$img_url);

What is curl and how to use it in a PHP code file.

curl is the client URL function library that enable you able to make live requests and getting data or result from live resources and much more.. PHP supports it through libcurl. To enable support for libcurl when installing PHP add --with-curl=[location of curl libraries] to the configure statement before compiling. The curl package must be installed prior to installing PHP. Most major functions desired when connecting to remote web servers are included in curl, including POST and GET form posting, SSL support, HTTP authentication, session and cookie handling.

CURL requests For Search keywords

Curl is good for getting remote data and making dynamic requests.

<form method="post"><input type="text" name="search" value="india"><input type="submit" value="Search"></form>

<?php
// create a new cURL resource
$ch = curl_init();

// set URL and other appropriate options
$result_cnt=2;
$search=$_REQUEST['search']?$_REQUEST['search']:"";
$url="http://www.google.co.in/search?num=$result_cnt&hl=en&safe=off&q={$search}";
Syndicate content

Popular Tags

tags in Web Links