开发者

upload a image with post method with xml

I am bit stuck about how to pase the imag开发者_如何学运维e in post method with xml parsing . I am able to send the string values but dont know how to send the images . A code snippet will be very helpful or any tutorial or link.

My url is something like this http://66.45.25.240/XML/EditProfile.aspx?myguid=45&guid=45&name=aditya&email=xyz@gmail.com&cell=1234567890&title=Title&twitterhandle=tutu.com&facebookhandle=ad@ad.com&picture=a124.jpg

Here i dont know how to pass the picture part . Regards Mrugen


You shouldn't use HTTP GET because the possible length of the parameters is very limited.

Use POST instead. Here's a link to an example


    <?php
 $i= 0; // counter
$url = "http://post.jagran.com/rss/post/category/Bollywood.xml"; // url to parse
$rss = simplexml_load_file($url); // XML parser

// RSS items loop

print '<h2><img style="vertical-align: middle;" src="'.$rss->channel->image->url.'" /> '.$rss->channel->title.'</h2>'; // channel title + img with src

foreach($rss->channel->item as $item) {
if ($i < 10) { // parse only 10 items
    print '<a href="'.$item->link.'">'.$item->title.'</a><br />';
    print '<a href="'.$item['image']->link.'">'.$item['image']->url.'</a><br />';

}

$i++;
} 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜